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

Function expressionToDictionaryValue

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

Source from the content-addressed store, hash-verified

558}
559
560function expressionToDictionaryValue(
561 expr: MathJsonExpression | null | undefined
562): DictionaryValue | null {
563 if (expr === null || expr === undefined) return null;
564 if (isStringObject(expr)) return expr.str;
565 if (isNumberObject(expr)) return parseFloat(expr.num);
566 if (isSymbolObject(expr)) return expr.sym;
567
568 if (typeof expr === 'string' || typeof expr === 'number') return expr;
569
570 if (Array.isArray(expr)) return { fn: expr } as MathJsonFunctionObject;
571
572 return expr;
573}

Callers 1

dictionaryFromExpressionFunction · 0.85

Calls 3

isStringObjectFunction · 0.85
isNumberObjectFunction · 0.85
isSymbolObjectFunction · 0.85

Tested by

no test coverage detected