MCPcopy Index your code
hub / github.com/loggerhead/json4u / getNodeType

Function getNodeType

src/lib/parser/parse.ts:297–316  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

295}
296
297function getNodeType(value: any): NodeType {
298 switch (typeof value) {
299 case "boolean":
300 return "boolean";
301 case "number":
302 return "number";
303 case "string":
304 return "string";
305 case "object": {
306 if (!value) {
307 return "null";
308 } else if (Array.isArray(value)) {
309 return "array";
310 }
311 return "object";
312 }
313 default:
314 return "null";
315 }
316}
317
318function maybeIterable(v: string) {
319 return typeof v === "string" && (/^\s*\{.*\}\s*$/.test(v) || /^\s*\[.*\]\s*$/.test(v));

Callers 1

onLiteralValueMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected