Files
codeql-action/node_modules/@protobuf-ts/runtime/build/es2015/json-typings.js
Angela P Wen a196a714b8 Bump artifact dependencies if CODEQL_ACTION_ARTIFACT_V2_UPGRADE enabled (#2482)
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
Co-authored-by: Henry Mercer <henrymercer@github.com>
2024-10-01 09:59:05 -07:00

21 lines
505 B
JavaScript

/**
* Get the type of a JSON value.
* Distinguishes between array, null and object.
*/
export function typeofJsonValue(value) {
let t = typeof value;
if (t == "object") {
if (Array.isArray(value))
return "array";
if (value === null)
return "null";
}
return t;
}
/**
* Is this a JSON object (instead of an array or null)?
*/
export function isJsonObject(value) {
return value !== null && typeof value == "object" && !Array.isArray(value);
}