import type { NumOrString, Path } from "@thi.ng/api"; /** * Converts the given key path to canonical form (array). * * @remarks * If given path is an array, performs a check to ensure that all path items are * strings or numbers (throws error if needed). * * Use {@link disallowProtoPath} for extended functionality to also check for * illegal paths like `[["__proto__"], "foo"]` and throw an error if needed. * * Also see . * * ```ts tangle:../export/to-path.ts * import { toPath } from "@thi.ng/paths"; * * console.log(toPath("a.b.c")); * // ["a", "b", "c"] * * console.log(toPath(0)); * // [0] * * console.log(toPath(["a", "b", "c"])); * // ["a", "b", "c"] * ``` * * @param path - */ export declare const toPath: (path: Path) => readonly NumOrString[]; /** * Takes an arbitrary object and lookup path. Descends into object along * path and returns true if the full path exists (even if final leaf * value is `null` or `undefined`). Checks are performed using * `hasOwnProperty()`. * * @param obj - * @param path - */ export declare const exists: (obj: any, path: Path) => boolean; /** * Helper function. First canonicalizes given `path` using {@link toPath} and * then checks it via * [`isProtoPath()`](https://docs.thi.ng/umbrella/checks/functions/isProtoPath.html). * Throws an error if path contains any property which might lead to prototype * poisoning. Returns canonical path if valid. * * @remarks * The following properties are considered illegal. * * - `__proto__` * - `prototype` * - `constructor` * * @param path - */ export declare const disallowProtoPath: (path: Path) => readonly NumOrString[]; //# sourceMappingURL=path.d.ts.map