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

Function parseVal

test/compute-engine/latex-syntax/numbers.test.ts:10–16  ·  view source on GitHub ↗

parseVal checks that the result is a numericValue (or an integer)

(s: string)

Source from the content-addressed store, hash-verified

8
9/** parseVal checks that the result is a numericValue (or an integer) */
10function 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
18describe('PARSING OF NUMBER', () => {
19 test('Basic Parsing', () => {

Callers 1

numbers.test.tsFile · 0.85

Calls 3

isNumberFunction · 0.90
parseMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected