(str)
| 628 | } |
| 629 | |
| 630 | const 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. |
no outgoing calls
no test coverage detected