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

Function operand

src/math-json/utils.ts:160–169  ·  view source on GitHub ↗
(
  expr: MathJsonExpression | null,
  n: 1 | 2 | 3
)

Source from the content-addressed store, hash-verified

158
159/** Return the nth operand of a function expression */
160export function operand(
161 expr: MathJsonExpression | null,
162 n: 1 | 2 | 3
163): MathJsonExpression | null {
164 if (Array.isArray(expr)) return expr[n] ?? null;
165
166 if (expr === null || !isFunctionObject(expr)) return null;
167
168 return expr.fn[n] ?? null;
169}
170
171export function nops(expr: MathJsonExpression | null | undefined): number {
172 if (expr === null || expr === undefined) return 0;

Callers 15

serializeCortexFunction · 0.90
serializeOperatorFunction · 0.90
parse-cortex.tsFile · 0.90
serializeBaseFormFunction · 0.90
serializeNumberFunction · 0.90
isSinglePowerDenominatorFunction · 0.90
parseArgumentsMethod · 0.90
singleArgCommandFunction · 0.90
grabItemFunction · 0.90
unitToMathrmFunction · 0.90

Calls 1

isFunctionObjectFunction · 0.85

Tested by

no test coverage detected