MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / isValidSymbol

Function isValidSymbol

src/math-json/symbols.ts:62–76  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

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

Callers 12

symbols.test.tsFile · 0.90
normalizeIdentifierMethod · 0.90
createSymbolExpressionFunction · 0.90
declareFnFunction · 0.90
validateDefinitionNameFunction · 0.90
constructorMethod · 0.90
boxFunctionFunction · 0.90
boxFunction · 0.90
parseInvalidSymbolFunction · 0.90
parseSymbolFunction · 0.90
isValidEntryFunction · 0.90
validateSymbolFunction · 0.85

Calls 1

isRecommendedScriptsFunction · 0.85

Tested by

no test coverage detected