lodash-omitdeep
Version:
lodash omitDeep/omitByDeep object key/value recursively
26 lines (25 loc) • 1.02 kB
TypeScript
import type { Many, PartialObject, PropertyName } from 'lodash';
export declare const needOmit: (value: any) => boolean;
interface OmitDeep {
<T extends object, K extends PropertyName[]>(object: T | null | undefined, ...paths: K): Pick<T, Exclude<keyof T, K[number]>>;
<T extends object, K extends keyof T>(object: T | null | undefined, ...paths: Many<K>[]): Omit<T, K>;
<T extends object>(object: T | null | undefined, ...paths: Many<PropertyName>[]): PartialObject<T>;
}
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable properties of `object` that are not omitted.
*
* @category Function
* @param object The source object.
* @param [paths] The property names to omit, specified
* individually or in arrays.
* @returns Returns the new object.
* @example
*
* const object = { 'a': 1, 'b': 2, 'c': { 'a': 1, 'b': 2 } };
*
* omitDeep(object, ['b', 'a']);
* // => { 'c': {} }
*/
export declare const omitDeep: OmitDeep;
export {};