MCPcopy Create free account
hub / github.com/atomicdata-dev/atomic-data-browser / valToNumber

Function valToNumber

lib/src/value.ts:50–55  ·  view source on GitHub ↗
(val: JSONValue)

Source from the content-addressed store, hash-verified

48
49/** Returns a number of the value, or throws an error */
50export function valToNumber(val: JSONValue): number {
51 if (typeof val !== 'number') {
52 throw new Error(`Not a number: ${val}, is a ${typeof val}`);
53 }
54 return val;
55}
56
57/** Returns a default string representation of the value. */
58export function valToString(val: JSONValue): string {

Callers 1

useNumberFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected