parseVal checks that the result is a numericValue (or an integer)
(s: string)
| 8 | |
| 9 | /** parseVal checks that the result is a numericValue (or an integer) */ |
| 10 | function parseVal(s: string): string | number { |
| 11 | const expr = ce.parse(s); |
| 12 | if (!isNumber(expr)) return NaN; |
| 13 | const result = expr.numericValue; |
| 14 | if (typeof result === 'number') return result; |
| 15 | return result.toString(); |
| 16 | } |
| 17 | |
| 18 | describe('PARSING OF NUMBER', () => { |
| 19 | test('Basic Parsing', () => { |
no test coverage detected