UNPKG

@sagold/json-pointer

Version:

json pointer - failsafe data retrieval from js and json objects

14 lines (12 loc) 304 B
import { JsonPointer, JsonPath } from "./types"; /** * @returns true, if this pointer location is the root data */ export function isRoot(pointer: JsonPointer | JsonPath): boolean { return ( pointer === "#" || pointer === "" || (Array.isArray(pointer) && pointer.length === 0) || false ); }