UNPKG

pig-dam-core

Version:

Library that should be included in every Pig DAM project we build

44 lines 1.62 kB
/** * Date: 2019-07-09 * Time: 21:45 * @license MIT (see project's LICENSE file) */ export declare type RemovableFilter = (value: any, key: string) => boolean; export declare type RemovableType = any | RemovableFilter; /** * Deletes the object at the property path in `object` */ export declare function deletePath(object: { [key: string]: any; }, path: string): { [key: string]: any; }; /** * A variation of lodash's set but only sets if the value is not set: * - if object is not set then it defaults to {} * - it returns the value at "path" * @returns same object passed as <param>object</object> */ export declare function ensure<T>(object: { [key: string]: any; }, path: string, value: T): { [key: string]: any; }; /** * Removes properties of objects with <param>removables</param>values. It does not remove <param>removables</param> from arrays * but it does recursively process array elements and should they be objects then it will scrub those objects. * Note: must be careful to make sure there are no recursive references inside your object. * @param object will only process object passing isObject test * @param recursive whether to recurse into children properties * @param removables object or array of objects that qualify as or test for `remove` * @returns same object passed as <param>object</object> */ export declare function scrub(object: { [key: string]: any; } | undefined | null, { recursive, removables }?: { recursive?: boolean; removables?: RemovableType[]; }): { [key: string]: any; } | undefined | null; //# sourceMappingURL=object.d.ts.map