lodash-omitdeep
Version:
lodash omitDeep/omitByDeep object key/value recursively
25 lines (24 loc) • 997 B
TypeScript
import type { Dictionary, NumericDictionary, PartialObject, ValueKeyIteratee } from 'lodash';
interface OmitDeepBy {
<T>(object: Dictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): Dictionary<T>;
<T>(object: NumericDictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): NumericDictionary<T>;
<T extends object>(object: T | null | undefined, predicate: ValueKeyIteratee<T[keyof T]>): PartialObject<T>;
}
/**
* The opposite of `_.pickBy`; this method creates an object composed of the
* own and inherited enumerable properties of `object` that `predicate`
* doesn't return truthy for.
*
* @category Function
* @param object The source object.
* @param [predicate] The function invoked per property.
* @returns Returns the new object.
* @example
*
* const object = { 'a': 1, 'b': null, 'c': { 'a': 1, 'b': null } };
*
* omitByDeep(object, _.isNil);
* // => { 'a': 1, 'c': { 'a': 1 } }
*/
export declare const omitDeepBy: OmitDeepBy;
export {};