{"version":3,"file":"omitDeepBy.mjs","sources":["../../../src/omitDeepBy/omitDeepBy.ts"],"sourcesContent":["import type {\r\n  Dictionary,\r\n  NumericDictionary,\r\n  PartialObject,\r\n  PropertyName,\r\n  ValueKeyIteratee\r\n} from 'lodash';\r\n\r\nimport lodash from 'lodash';\r\n\r\ninterface OmitDeepBy {\r\n  <T>(object: Dictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): Dictionary<T>;\r\n  <T>(\r\n    object: NumericDictionary<T> | null | undefined,\r\n    predicate?: ValueKeyIteratee<T>\r\n  ): NumericDictionary<T>;\r\n  <T extends object>(\r\n    object: T | null | undefined,\r\n    predicate: ValueKeyIteratee<T[keyof T]>\r\n  ): PartialObject<T>;\r\n}\r\n\r\n/**\r\n * The opposite of `_.pickBy`; this method creates an object composed of the\r\n * own and inherited enumerable properties of `object` that `predicate`\r\n * doesn't return truthy for.\r\n *\r\n * @category Function\r\n * @param object The source object.\r\n * @param [predicate] The function invoked per property.\r\n * @returns Returns the new object.\r\n * @example\r\n *\r\n * const object = { 'a': 1, 'b': null, 'c': { 'a': 1, 'b': null } };\r\n *\r\n * omitByDeep(object, _.isNil);\r\n * // => { 'a': 1, 'c': { 'a': 1 } }\r\n */\r\nexport const omitDeepBy: OmitDeepBy = (object: any, cb: any) => {\r\n  function omitByDeepByOnOwnProps(object: any) {\r\n    if (!Array.isArray(object) && !lodash.isPlainObject(object)) {\r\n      return object;\r\n    }\r\n\r\n    if (Array.isArray(object)) {\r\n      return object.map((element) => omitDeepBy(element, cb));\r\n    }\r\n\r\n    const temp = {};\r\n\r\n    for (const [key, value] of Object.entries<{\r\n      [x: string]: object | PropertyName;\r\n    }>(object)) {\r\n      (temp as any)[key] = omitDeepBy(value, cb);\r\n    }\r\n    return lodash.omitBy(temp, cb);\r\n  }\r\n\r\n  return omitByDeepByOnOwnProps(object);\r\n};\r\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;"}