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

Function symbol

src/math-json/utils.ts:186–200  ·  view source on GitHub ↗
(
  expr: MathJsonExpression | null | undefined
)

Source from the content-addressed store, hash-verified

184}
185
186export function symbol(
187 expr: MathJsonExpression | null | undefined
188): string | null {
189 // Is it a symbol shorthand?
190 if (typeof expr === 'string' && matchesSymbol(expr)) {
191 if (expr.length >= 2 && expr.at(0) === '`' && expr.at(-1) === '`')
192 return expr.slice(1, -1);
193 return expr;
194 }
195
196 if (expr === null || expr === undefined) return null;
197
198 if (isSymbolObject(expr)) return expr.sym;
199 return null;
200}
201
202function keyValuePair(
203 expr: MathJsonExpression | null | undefined

Callers 15

serializeExpressionFunction · 0.90
serializeSymbolFunction · 0.90
identifierFunction · 0.90
primaryFunction · 0.90
boxFunction · 0.90
wrapShortMethod · 0.90
serializeSymbolMethod · 0.90
serializeMethod · 0.90
unitToMathrmFunction · 0.90
jsonHasSymbolFunction · 0.90
findSeriesVariableFunction · 0.90

Calls 4

matchesSymbolFunction · 0.85
isSymbolObjectFunction · 0.85
atMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected