( expr: MathJsonExpression | null | undefined )
| 184 | } |
| 185 | |
| 186 | export 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 | |
| 202 | function keyValuePair( |
| 203 | expr: MathJsonExpression | null | undefined |
no test coverage detected