MCPcopy Create free account
hub / github.com/codecombat/codecombat / removeAI

Function removeAI

app/core/utils.js:630–648  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

628}
629
630const removeAI = function (str) {
631 // we have some objects as return value.
632 // when ai translation finished we can know how to deal with them
633 // now return first
634 if (!str) {
635 return ''
636 }
637 if (typeof str === 'object') {
638 const newObject = {}
639 Object.keys(str).forEach((key) => {
640 newObject[key] = removeAI(str[key])
641 })
642 return newObject
643 }
644 if (typeof str !== 'string') {
645 return str
646 }
647 return str.replace(/^\[AI_TRANSLATION\]/, '')
648}
649
650// @param {Object} say - the object containing an i18n property.
651// @param {string} target - the attribute that you want to access.

Callers 2

i18nFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected