(s: string)
| 60 | ]; |
| 61 | |
| 62 | // Combine the recommended script properties into a single regex pattern |
| 63 | const regexPattern = `^[${recommendedScripts |
| 64 | .map((x) => `\\p{Script=${x}}`) |
| 65 | .join('')}]*$`; |
| 66 | |
| 67 | recommendedScriptsRegex = new RegExp(regexPattern, 'u'); |
| 68 | } |
| 69 | // Test if the input text contains only characters from the |
| 70 | // recommended scripts |
| 71 | return recommendedScriptsRegex.test(text); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Return true if the string is a valid symbol. |
| 76 | * |
| 77 | * Check for symbols matching a profile of [Unicode UAX31](https://unicode.org/reports/tr31/) |
| 78 | * |
| 79 | * See https://cortexjs.io/math-json/#symbols for a full definition of the |
no test coverage detected