( expr: MathJsonExpression | null, n: 1 | 2 | 3 )
| 158 | |
| 159 | /** Return the nth operand of a function expression */ |
| 160 | export 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 | |
| 171 | export function nops(expr: MathJsonExpression | null | undefined): number { |
| 172 | if (expr === null || expr === undefined) return 0; |
no test coverage detected