MCPcopy Index your code
hub / github.com/atomicdata-dev/atomic-data-browser / valToArray

Function valToArray

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

Source from the content-addressed store, hash-verified

11 * or Nested Resources. Throws an error when fails
12 */
13export function valToArray(val: JSONValue): string[] {
14 if (val == undefined) {
15 throw new Error(`Not an array: ${val}, is ${typeof val}`);
16 }
17 if (val.constructor == Array) {
18 // TODO: check this better
19 return val as string[];
20 }
21 throw new Error(`Not an array: ${val}, is a ${typeof val}`);
22}
23
24/** Tries to make a boolean from this value. Throws if it is not a boolean. */
25export function valToBoolean(val: JSONValue): boolean {

Callers 6

propertyLineFunction · 0.90
useArrayFunction · 0.90
canWriteMethod · 0.90
getArrayMethod · 0.90
getClassesMethod · 0.90
ValueCompFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected