{"version":3,"file":"omitDeepBy.mjs","sources":["../../../src/omitDeepBy/omitDeepBy.ts"],"sourcesContent":["import type {\n  Dictionary,\n  NumericDictionary,\n  PartialObject,\n  PropertyName,\n  ValueKeyIteratee\n} from 'lodash';\n\nimport lodash from 'lodash';\n\ninterface OmitDeepBy {\n  <T>(object: Dictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): Dictionary<T>;\n  <T>(\n    object: NumericDictionary<T> | null | undefined,\n    predicate?: ValueKeyIteratee<T>\n  ): NumericDictionary<T>;\n  <T extends object>(\n    object: T | null | undefined,\n    predicate: ValueKeyIteratee<T[keyof T]>\n  ): PartialObject<T>;\n}\n\n/**\n * The opposite of `_.pickBy`; this method creates an object composed of the\n * own and inherited enumerable properties of `object` that `predicate`\n * doesn't return truthy for.\n *\n * @category Function\n * @param object The source object.\n * @param [predicate] The function invoked per property.\n * @returns Returns the new object.\n * @example\n *\n * const object = { 'a': 1, 'b': null, 'c': { 'a': 1, 'b': null } };\n *\n * omitByDeep(object, _.isNil);\n * // => { 'a': 1, 'c': { 'a': 1 } }\n */\nexport const omitDeepBy: OmitDeepBy = (object: any, cb: any) => {\n  function omitByDeepByOnOwnProps(object: any) {\n    if (!Array.isArray(object) && !lodash.isPlainObject(object)) {\n      return object;\n    }\n\n    if (Array.isArray(object)) {\n      return object.map((element) => omitDeepBy(element, cb));\n    }\n\n    const temp = {};\n\n    for (const [key, value] of Object.entries<{\n      [x: string]: object | PropertyName;\n    }>(object)) {\n      (temp as any)[key] = omitDeepBy(value, cb);\n    }\n    return lodash.omitBy(temp, cb);\n  }\n\n  return omitByDeepByOnOwnProps(object);\n};\n"],"names":["omitDeepBy","object","cb","omitByDeepByOnOwnProps","lodash","element","temp","key","value"],"mappings":";AAsCa,MAAAA,IAAyB,CAACC,GAAaC,MAAY;AAC9D,WAASC,EAAuBF,GAAa;AACvC,QAAA,CAAC,MAAM,QAAQA,CAAM,KAAK,CAACG,EAAO,cAAcH,CAAM;AACjDA,aAAAA;AAGL,QAAA,MAAM,QAAQA,CAAM;AACtB,aAAOA,EAAO,IAAI,CAACI,MAAYL,EAAWK,GAASH,CAAE,CAAC;AAGxD,UAAMI,IAAO,CAAC;AAEd,eAAW,CAACC,GAAKC,CAAK,KAAK,OAAO,QAE/BP,CAAM;AACN,MAAAK,EAAaC,CAAG,IAAIP,EAAWQ,GAAON,CAAE;AAEpC,WAAAE,EAAO,OAAOE,GAAMJ,CAAE;AAAA,EAAA;AAG/B,SAAOC,EAAuBF,CAAM;AACtC;"}