pig-dam-core
Version:
Library that should be included in every Pig DAM project we build
63 lines • 1.95 kB
TypeScript
/**
* Date: 2019-07-09
* Time: 21:45
* @license MIT (see project's LICENSE file)
*/
import * as mutable from "../mutable/object";
/**
* Clones an object or object path
* @param object
* @param path - It minimized the amount of data that needs to be cloned
* @param {boolean} deep
* @returns {Object}
*/
export declare function clone(object: {
[key: string]: any;
}, { deep, path }?: {
deep?: boolean;
path?: string;
}): {
[key: string]: any;
};
/**
* Deletes the object at the property path in `object`
* @param {Object|Array|null} object
* @param {string} path
* @returns {Object|Array}
*/
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"
*/
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`
*/
export declare function scrub(object: {
[key: string]: any;
} | null | undefined, { recursive, removables }?: {
recursive?: boolean;
removables?: mutable.RemovableType[];
}): {
[key: string]: any;
} | null | undefined;
/**
* Recursively sorts object's properties
*/
export declare function sort(object: any): any;
//# sourceMappingURL=object.d.ts.map