MCPcopy Create free account
hub / github.com/JohnWeisz/TypedJSON / parseToJSObject

Function parseToJSObject

src/helpers.ts:65–70  ·  view source on GitHub ↗
(json: any, expectedType: Serializable<T>)

Source from the content-addressed store, hash-verified

63}
64
65export function parseToJSObject<T>(json: any, expectedType: Serializable<T>): Object {
66 if (typeof json !== 'string' || shouldOmitParseString(json, expectedType)) {
67 return json;
68 }
69 return JSON.parse(json);
70}
71
72/**
73 * Determines if 'A' is a sub-type of 'B' (or if 'A' equals 'B').

Callers 5

parseMethod · 0.90
parseAsArrayMethod · 0.90
parseAsSetMethod · 0.90
parseAsMapMethod · 0.90

Calls 2

shouldOmitParseStringFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected