{"version":3,"file":"index.cjs","names":[],"sources":["../../src/omitDeep/omitDeep.ts","../../src/omitDeepBy/omitDeepBy.ts"],"sourcesContent":["import type { Many, PartialObject, PropertyName } from 'lodash';\n\nimport lodash from 'lodash';\n\nexport const needOmit = (value: any) =>\n  !lodash.isNil(value) && (lodash.isPlainObject(value) || Array.isArray(value));\n\ninterface OmitDeep {\n  <T extends object, K extends PropertyName[]>(\n    object: T | null | undefined,\n    ...paths: K\n  ): Pick<T, Exclude<keyof T, K[number]>>;\n  <T extends object, K extends keyof T>(\n    object: T | null | undefined,\n    ...paths: Many<K>[]\n  ): Omit<T, K>;\n  <T extends object>(\n    object: T | null | undefined,\n    ...paths: Many<PropertyName>[]\n  ): PartialObject<T>;\n}\n\n/**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable properties of `object` that are not omitted.\n *\n * @category Function\n * @param object The source object.\n * @param [paths] The property names to omit, specified\n *  individually or in arrays.\n * @returns Returns the new object.\n * @example\n *\n * const object = { 'a': 1, 'b': 2, 'c': { 'a': 1, 'b': 2 } };\n *\n * omitDeep(object, ['b', 'a']);\n * // => { 'c': {} }\n */\nexport const omitDeep: OmitDeep = (object: any, ...paths: any) => {\n  function omitDeepOnOwnProps(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) => (needOmit(element) ? omitDeep(element, ...paths) : element));\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] = needOmit(value) ? omitDeep(value, ...paths) : value;\n    }\n    return lodash.omit(temp, ...paths);\n  }\n\n  return omitDeepOnOwnProps(object);\n};\n","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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAa,YAAY,UACvB,CAAC,eAAO,MAAM,MAAM,KAAK,eAAO,cAAc,MAAM,IAAI,MAAM,QAAQ,MAAM;;;;;;;;;;;;;;;;;AAiC9E,MAAa,YAAsB,QAAa,GAAG,UAAe;CAChE,SAAS,mBAAmB,QAAa;AACvC,MAAI,CAAC,MAAM,QAAQ,OAAO,IAAI,CAAC,eAAO,cAAc,OAAO,CACzD,QAAO;AAGT,MAAI,MAAM,QAAQ,OAAO,CACvB,QAAO,OAAO,KAAK,YAAa,SAAS,QAAQ,GAAG,SAAS,SAAS,GAAG,MAAM,GAAG,QAAS;EAG7F,MAAM,OAAO,EAAE;AAEf,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAE/B,OAAO,CACR,CAAC,KAAa,OAAO,SAAS,MAAM,GAAG,SAAS,OAAO,GAAG,MAAM,GAAG;AAErE,SAAO,eAAO,KAAK,MAAM,GAAG,MAAM;;AAGpC,QAAO,mBAAmB,OAAO;;;;;;;;;;;;;;;;;;;;;ACpBnC,MAAa,cAA0B,QAAa,OAAY;CAC9D,SAAS,uBAAuB,QAAa;AAC3C,MAAI,CAAC,MAAM,QAAQ,OAAO,IAAI,CAAC,eAAO,cAAc,OAAO,CACzD,QAAO;AAGT,MAAI,MAAM,QAAQ,OAAO,CACvB,QAAO,OAAO,KAAK,YAAY,WAAW,SAAS,GAAG,CAAC;EAGzD,MAAM,OAAO,EAAE;AAEf,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAE/B,OAAO,CACR,CAAC,KAAa,OAAO,WAAW,OAAO,GAAG;AAE5C,SAAO,eAAO,OAAO,MAAM,GAAG;;AAGhC,QAAO,uBAAuB,OAAO"}