botbook/node_modules/@sagold/json-pointer/lib/isRoot.ts
Rodrigo Rodriguez 6ae15fe3e5 Updated.
2024-09-04 13:13:15 -03:00

13 lines
304 B
TypeScript

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
);
}