lodash-omitdeep 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/omitDeep/omitDeep.js +3 -0
- package/dist/cjs/omitDeep/omitDeep.js.map +1 -0
- package/dist/cjs/omitDeepBy/omitDeepBy.js +3 -0
- package/dist/cjs/omitDeepBy/omitDeepBy.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/omitDeep/omitDeep.js +2 -2
- package/dist/esm/omitDeep/omitDeep.js.map +1 -1
- package/dist/esm/omitDeepBy/omitDeepBy.js +2 -2
- package/dist/esm/omitDeepBy/omitDeepBy.js.map +1 -1
- package/package.json +2 -7
package/dist/cjs/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license lodash-omitdeep v1.3.
|
|
2
|
-
"use strict";var
|
|
1
|
+
/* @license lodash-omitdeep v1.3.3 */
|
|
2
|
+
"use strict";var e=require("./omitDeep/omitDeep.js"),i=require("./omitDeepBy/omitDeepBy.js");require("lodash.isnil"),require("lodash.isplainobject"),require("lodash.omit"),require("lodash.omitby"),exports.omitDeep=e.omitDeep,exports.omitDeepBy=i.omitDeepBy;
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license lodash-omitdeep v1.3.3 */
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("lodash.isnil"),t=require("lodash.isplainobject"),e=require("lodash.omit");function n(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,o,a,i,u=[],l=!0,c=!1;try{if(a=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;l=!1}else for(;!(l=(n=a.call(e)).done)&&(u.push(n.value),u.length!==t);l=!0);}catch(r){c=!0,o=r}finally{try{if(!l&&null!=e.return&&(i=e.return(),Object(i)!==i))return}finally{if(c)throw o}}return u}}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return o(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return o(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function a(e){return!r(e)&&(t(e)||Array.isArray(e))}var i=function r(o){for(var i=arguments.length,u=new Array(i>1?i-1:0),l=1;l<i;l++)u[l-1]=arguments[l];return function(o){if(!Array.isArray(o)&&!t(o))return o;if(Array.isArray(o))return o.map((function(t){return a(t)?r.apply(void 0,[t].concat(u)):t}));for(var i={},l=0,c=Object.entries(o);l<c.length;l++){var f=n(c[l],2),s=f[0],y=f[1];i[s]=a(y)?r.apply(void 0,[y].concat(u)):y}return e.apply(void 0,[i].concat(u))}(o)};exports.default=i,exports.omitDeep=i;
|
|
3
|
+
//# sourceMappingURL=omitDeep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omitDeep.js","sources":["../../../src/omitDeep/omitDeep.ts"],"sourcesContent":["import type { Many, PartialObject, PropertyName } from 'lodash';\nimport isNil from 'lodash.isnil';\nimport isPlainObject from 'lodash.isplainobject';\nimport omit from 'lodash.omit';\n\nfunction needOmit(value: any): boolean {\n return !isNil(value) && (isPlainObject(value) || Array.isArray(value));\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 */\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\nexport const omitDeep: OmitDeep = (object: any, ...paths: any) => {\n function omitDeepOnOwnProps(object: any) {\n if (!Array.isArray(object) && !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 // eslint-disable-next-line no-restricted-syntax\n for (const [key, value] of Object.entries<{\n [x: string]: PropertyName | object;\n }>(object)) {\n (temp as any)[key] = needOmit(value) ? omitDeep(value, ...paths) : value;\n }\n return omit(temp, ...paths);\n }\n\n return omitDeepOnOwnProps(object);\n};\n\nexport default omitDeep;\n"],"names":["needOmit","value","isNil","isPlainObject","Array","isArray","omitDeep","object","_len","arguments","length","paths","_key","map","element","apply","concat","temp","_i","_Object$entries","Object","entries","_Object$entries$_i","_slicedToArray","key","omit","omitDeepOnOwnProps"],"mappings":";4rCAKA,SAASA,EAASC,GAChB,OAAQC,EAAMD,KAAWE,EAAcF,IAAUG,MAAMC,QAAQJ,GACjE,KAiCaK,EAAqB,SAArBA,EAAsBC,GAA+B,IAAAC,IAAAA,EAAAC,UAAAC,OAAfC,MAAKP,MAAAI,EAAAA,EAAAA,OAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAALD,EAAKC,EAAAH,GAAAA,UAAAG,GAoBtD,OAnBA,SAA4BL,GAC1B,IAAKH,MAAMC,QAAQE,KAAYJ,EAAcI,GAC3C,OAAOA,EAGT,GAAIH,MAAMC,QAAQE,GAChB,OAAOA,EAAOM,KAAI,SAACC,GAAO,OAAMd,EAASc,GAAWR,EAAQS,WAACD,EAAAA,CAAAA,GAAOE,OAAKL,IAASG,CAAO,IAK3F,IAFA,IAAMG,EAAO,CAAA,EAEbC,EAAAC,EAAAA,EAA2BC,OAAOC,QAE/Bd,GAAOW,EAAAC,EAAAT,OAAAQ,IAAE,CAFP,IAAAI,EAAAC,EAAAJ,EAAAD,GAAA,GAAOM,EAAGF,EAAA,GAAErB,EAAKqB,EAAA,GAGnBL,EAAaO,GAAOxB,EAASC,GAASK,EAAQS,WAAA,EAAA,CAACd,GAAKe,OAAKL,IAASV,CACrE,CACA,OAAOwB,EAAIV,WAAA,EAAA,CAACE,GAAID,OAAKL,GACvB,CAEOe,CAAmBnB,EAC5B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @license lodash-omitdeep v1.3.3 */
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("lodash.isplainobject"),t=require("lodash.omitby");function e(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,o,i,u,a=[],l=!0,f=!1;try{if(i=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;l=!1}else for(;!(l=(n=i.call(e)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(r){f=!0,o=r}finally{try{if(!l&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return n(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return n(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}var o=function n(o,i){return function(o){if(!Array.isArray(o)&&!r(o))return o;if(Array.isArray(o))return o.map((function(r){return n(r,i)}));for(var u={},a=0,l=Object.entries(o);a<l.length;a++){var f=e(l[a],2),c=f[0],s=f[1];u[c]=n(s,i)}return t(u,i)}(o)};exports.default=o,exports.omitDeepBy=o;
|
|
3
|
+
//# sourceMappingURL=omitDeepBy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omitDeepBy.js","sources":["../../../src/omitDeepBy/omitDeepBy.ts"],"sourcesContent":["import type {\n Dictionary,\n NumericDictionary,\n PartialObject,\n PropertyName,\n ValueKeyIteratee\n} from 'lodash';\nimport isPlainObject from 'lodash.isplainobject';\nimport omitBy from 'lodash.omitby';\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=_.identity] 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 */\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\nexport const omitDeepBy: OmitDeepBy = (object: any, cb: any) => {\n function omitByDeepByOnOwnProps(object: any) {\n if (!Array.isArray(object) && !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 // eslint-disable-next-line no-restricted-syntax\n for (const [key, value] of Object.entries<{\n [x: string]: PropertyName | object;\n }>(object)) {\n (temp as any)[key] = omitDeepBy(value, cb);\n }\n return omitBy(temp, cb);\n }\n\n return omitByDeepByOnOwnProps(object);\n};\n\nexport default omitDeepBy;\n"],"names":["omitDeepBy","object","cb","Array","isArray","isPlainObject","map","element","temp","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","key","value","omitBy","omitByDeepByOnOwnProps"],"mappings":";oqCAuCO,IAAMA,EAAyB,SAAzBA,EAA0BC,EAAaC,GAoBlD,OAnBA,SAAgCD,GAC9B,IAAKE,MAAMC,QAAQH,KAAYI,EAAcJ,GAC3C,OAAOA,EAGT,GAAIE,MAAMC,QAAQH,GAChB,OAAOA,EAAOK,KAAI,SAACC,GAAO,OAAKP,EAAWO,EAASL,MAKrD,IAFA,IAAMM,EAAO,CAAA,EAEbC,EAAAC,EAAAA,EAA2BC,OAAOC,QAE/BX,GAAOQ,EAAAC,EAAAG,OAAAJ,IAAE,CAFP,IAAAK,EAAAC,EAAAL,EAAAD,GAAA,GAAOO,EAAGF,EAAA,GAAEG,EAAKH,EAAA,GAGnBN,EAAaQ,GAAOhB,EAAWiB,EAAOf,EACzC,CACA,OAAOgB,EAAOV,EAAMN,EACtB,CAEOiB,CAAuBlB,EAChC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license lodash-omitdeep v1.3.
|
|
2
|
-
export{omitDeep}from"./omitDeep/omitDeep.js";export{omitDeepBy}from"./omitDeepBy/omitDeepBy.js";
|
|
1
|
+
/* @license lodash-omitdeep v1.3.3 */
|
|
2
|
+
export{omitDeep}from"./omitDeep/omitDeep.js";export{omitDeepBy}from"./omitDeepBy/omitDeepBy.js";import"lodash.isnil";import"lodash.isplainobject";import"lodash.omit";import"lodash.omitby";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license lodash-omitdeep v1.3.
|
|
2
|
-
import r from"lodash.isnil";import
|
|
1
|
+
/* @license lodash-omitdeep v1.3.3 */
|
|
2
|
+
import r from"lodash.isnil";import t from"lodash.isplainobject";import n from"lodash.omit";function e(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,a,i,l=[],u=!0,f=!1;try{if(a=(n=n.call(r)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(e=a.call(n)).done)&&(l.push(e.value),l.length!==t);u=!0);}catch(r){f=!0,o=r}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw o}}return l}}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return o(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=new Array(t);n<t;n++)e[n]=r[n];return e}function a(n){return!r(n)&&(t(n)||Array.isArray(n))}var i=function r(o){for(var i=arguments.length,l=new Array(i>1?i-1:0),u=1;u<i;u++)l[u-1]=arguments[u];return function(o){if(!Array.isArray(o)&&!t(o))return o;if(Array.isArray(o))return o.map((function(t){return a(t)?r.apply(void 0,[t].concat(l)):t}));for(var i={},u=0,f=Object.entries(o);u<f.length;u++){var c=e(f[u],2),y=c[0],s=c[1];i[y]=a(s)?r.apply(void 0,[s].concat(l)):s}return n.apply(void 0,[i].concat(l))}(o)};export{i as default,i as omitDeep};
|
|
3
3
|
//# sourceMappingURL=omitDeep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omitDeep.js","sources":["../../../src/omitDeep/omitDeep.ts"],"sourcesContent":["import isNil from 'lodash.isnil';\nimport isPlainObject from 'lodash.isplainobject';\nimport omit from 'lodash.omit';\nfunction needOmit(value) {\n
|
|
1
|
+
{"version":3,"file":"omitDeep.js","sources":["../../../src/omitDeep/omitDeep.ts"],"sourcesContent":["import type { Many, PartialObject, PropertyName } from 'lodash';\nimport isNil from 'lodash.isnil';\nimport isPlainObject from 'lodash.isplainobject';\nimport omit from 'lodash.omit';\n\nfunction needOmit(value: any): boolean {\n return !isNil(value) && (isPlainObject(value) || Array.isArray(value));\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 */\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\nexport const omitDeep: OmitDeep = (object: any, ...paths: any) => {\n function omitDeepOnOwnProps(object: any) {\n if (!Array.isArray(object) && !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 // eslint-disable-next-line no-restricted-syntax\n for (const [key, value] of Object.entries<{\n [x: string]: PropertyName | object;\n }>(object)) {\n (temp as any)[key] = needOmit(value) ? omitDeep(value, ...paths) : value;\n }\n return omit(temp, ...paths);\n }\n\n return omitDeepOnOwnProps(object);\n};\n\nexport default omitDeep;\n"],"names":["needOmit","value","isNil","isPlainObject","Array","isArray","omitDeep","object","_len","arguments","length","paths","_key","map","element","apply","concat","temp","_i","_Object$entries","Object","entries","_Object$entries$_i","_slicedToArray","key","omit","omitDeepOnOwnProps"],"mappings":";0nCAKA,SAASA,EAASC,GAChB,OAAQC,EAAMD,KAAWE,EAAcF,IAAUG,MAAMC,QAAQJ,GACjE,KAiCaK,EAAqB,SAArBA,EAAsBC,GAA+B,IAAAC,IAAAA,EAAAC,UAAAC,OAAfC,MAAKP,MAAAI,EAAAA,EAAAA,OAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAALD,EAAKC,EAAAH,GAAAA,UAAAG,GAoBtD,OAnBA,SAA4BL,GAC1B,IAAKH,MAAMC,QAAQE,KAAYJ,EAAcI,GAC3C,OAAOA,EAGT,GAAIH,MAAMC,QAAQE,GAChB,OAAOA,EAAOM,KAAI,SAACC,GAAO,OAAMd,EAASc,GAAWR,EAAQS,WAACD,EAAAA,CAAAA,GAAOE,OAAKL,IAASG,CAAO,IAK3F,IAFA,IAAMG,EAAO,CAAA,EAEbC,EAAAC,EAAAA,EAA2BC,OAAOC,QAE/Bd,GAAOW,EAAAC,EAAAT,OAAAQ,IAAE,CAFP,IAAAI,EAAAC,EAAAJ,EAAAD,GAAA,GAAOM,EAAGF,EAAA,GAAErB,EAAKqB,EAAA,GAGnBL,EAAaO,GAAOxB,EAASC,GAASK,EAAQS,WAAA,EAAA,CAACd,GAAKe,OAAKL,IAASV,CACrE,CACA,OAAOwB,EAAIV,WAAA,EAAA,CAACE,GAAID,OAAKL,GACvB,CAEOe,CAAmBnB,EAC5B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license lodash-omitdeep v1.3.
|
|
2
|
-
import r from"lodash.isplainobject";import
|
|
1
|
+
/* @license lodash-omitdeep v1.3.3 */
|
|
2
|
+
import r from"lodash.isplainobject";import t from"lodash.omitby";function n(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=n){var e,o,a,i,u=[],l=!0,f=!1;try{if(a=(n=n.call(r)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(e=a.call(n)).done)&&(u.push(e.value),u.length!==t);l=!0);}catch(r){f=!0,o=r}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw o}}return u}}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=new Array(t);n<t;n++)e[n]=r[n];return e}var o=function e(o,a){return function(o){if(!Array.isArray(o)&&!r(o))return o;if(Array.isArray(o))return o.map((function(r){return e(r,a)}));for(var i={},u=0,l=Object.entries(o);u<l.length;u++){var f=n(l[u],2),c=f[0],y=f[1];i[c]=e(y,a)}return t(i,a)}(o)};export{o as default,o as omitDeepBy};
|
|
3
3
|
//# sourceMappingURL=omitDeepBy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omitDeepBy.js","sources":["../../../src/omitDeepBy/omitDeepBy.ts"],"sourcesContent":["import isPlainObject from 'lodash.isplainobject';\nimport omitBy from 'lodash.omitby';\nexport const omitDeepBy = (object, cb) => {\n
|
|
1
|
+
{"version":3,"file":"omitDeepBy.js","sources":["../../../src/omitDeepBy/omitDeepBy.ts"],"sourcesContent":["import type {\n Dictionary,\n NumericDictionary,\n PartialObject,\n PropertyName,\n ValueKeyIteratee\n} from 'lodash';\nimport isPlainObject from 'lodash.isplainobject';\nimport omitBy from 'lodash.omitby';\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=_.identity] 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 */\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\nexport const omitDeepBy: OmitDeepBy = (object: any, cb: any) => {\n function omitByDeepByOnOwnProps(object: any) {\n if (!Array.isArray(object) && !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 // eslint-disable-next-line no-restricted-syntax\n for (const [key, value] of Object.entries<{\n [x: string]: PropertyName | object;\n }>(object)) {\n (temp as any)[key] = omitDeepBy(value, cb);\n }\n return omitBy(temp, cb);\n }\n\n return omitByDeepByOnOwnProps(object);\n};\n\nexport default omitDeepBy;\n"],"names":["omitDeepBy","object","cb","Array","isArray","isPlainObject","map","element","temp","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","key","value","omitBy","omitByDeepByOnOwnProps"],"mappings":";gmCAuCO,IAAMA,EAAyB,SAAzBA,EAA0BC,EAAaC,GAoBlD,OAnBA,SAAgCD,GAC9B,IAAKE,MAAMC,QAAQH,KAAYI,EAAcJ,GAC3C,OAAOA,EAGT,GAAIE,MAAMC,QAAQH,GAChB,OAAOA,EAAOK,KAAI,SAACC,GAAO,OAAKP,EAAWO,EAASL,MAKrD,IAFA,IAAMM,EAAO,CAAA,EAEbC,EAAAC,EAAAA,EAA2BC,OAAOC,QAE/BX,GAAOQ,EAAAC,EAAAG,OAAAJ,IAAE,CAFP,IAAAK,EAAAC,EAAAL,EAAAD,GAAA,GAAOO,EAAGF,EAAA,GAAEG,EAAKH,EAAA,GAGnBN,EAAaQ,GAAOhB,EAAWiB,EAAOf,EACzC,CACA,OAAOgB,EAAOV,EAAMN,EACtB,CAEOiB,CAAuBlB,EAChC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lodash-omitdeep",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "lodash omitDeep/omitByDeep object key/value recursively",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"author": {
|
|
@@ -74,10 +74,7 @@
|
|
|
74
74
|
"lodash.omitby": "^4.6.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@
|
|
78
|
-
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
79
|
-
"@rollup/plugin-terser": "^0.4.3",
|
|
80
|
-
"@rollup/plugin-typescript": "^11.1.3",
|
|
77
|
+
"@siberiacancode/builder": "^1.1.0",
|
|
81
78
|
"@siberiacancode/eslint": "^1.0.2",
|
|
82
79
|
"@siberiacancode/jest": "^1.0.1",
|
|
83
80
|
"@siberiacancode/prettier": "^1.0.0",
|
|
@@ -88,8 +85,6 @@
|
|
|
88
85
|
"@types/lodash.omitby": "^4.6.7",
|
|
89
86
|
"husky": "^8.0.1",
|
|
90
87
|
"lint-staged": "^14.0.1",
|
|
91
|
-
"rollup": "^3.29.2",
|
|
92
|
-
"rollup-plugin-dts": "^6.0.2",
|
|
93
88
|
"shx": "^0.3.4",
|
|
94
89
|
"ts-jest": "^29.1.1",
|
|
95
90
|
"typescript": "^5.2.2"
|