botbook/node_modules/@sagold/json-pointer/lib/isRoot.ts

14 lines
304 B
TypeScript
Raw Normal View History

2024-09-04 13:13:15 -03:00
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
);
}