honkit
Version:
HonKit is building beautiful books using Markdown.
17 lines • 1.02 kB
TypeScript
/**
* Minimal dot-path get/set with prototype-pollution guards.
* Replaces object-path for config key access (e.g. "plugins", "structure.readme").
*
* Behavior is kept compatible with the previous object-path wrapper:
* - get / set accept `string | string[]`
* - lookups only descend through own properties (matches object-path)
* - set throws when an intermediate value is a non-object scalar (string,
* number, boolean, null) — null follows from native JS, the others match
* object-path's check
* - set returns undefined
* - paths containing __proto__ / constructor / prototype are rejected as a
* whole, so e.g. "__proto__.polluted" does not collapse to "polluted"
*/
export declare function getAtPath(obj: Record<string, unknown> | null | undefined, path: string | string[], defaultValue?: unknown): unknown;
export declare function setAtPath(obj: Record<string, unknown> | null | undefined, path: string | string[], value: unknown): void;
//# sourceMappingURL=safeObjectPath.d.ts.map