( expr: MathJsonExpression | null | undefined )
| 558 | } |
| 559 | |
| 560 | function 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 | } |
no test coverage detected