@sparted/shared-library 1.0.21 → 1.0.22

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.
@@ -18,7 +18,7 @@ const stripPropertiesFromObject = (obj, properties) => {
18
18
  : nestedProperties
19
19
  .slice(0, nestedProperties.length - 1)
20
20
  .reduce((acc, property) => acc[property], copy);
21
- if (nestedObject !== undefined) {
21
+ if (nestedObject) {
22
22
  delete nestedObject[propertyToRemove];
23
23
  }
24
24
  });
@@ -1 +1 @@
1
- {"version":3,"file":"strip-properties-from-object.js","sources":["../../src/object/strip-properties-from-object.ts"],"sourcesContent":["import structuredClone from '@ungap/structured-clone';\n\nexport const stripPropertiesFromObject = <Output extends Record<any, any>, Input extends Record<any, any>>(\n obj: Input,\n properties: string[],\n): Output => {\n const copy = structuredClone(obj);\n\n properties.forEach((nestedPropertyStr) => {\n const nestedProperties = nestedPropertyStr.split('.');\n const propertyToRemove = nestedProperties[nestedProperties.length - 1];\n\n const nestedObject = nestedProperties.length === 1\n ? copy\n : nestedProperties\n .slice(0, nestedProperties.length - 1)\n .reduce((acc, property) => acc[property], copy);\n\n if (nestedObject !== undefined) {\n delete nestedObject[propertyToRemove];\n }\n });\n\n return copy;\n};\n"],"names":["structuredClone"],"mappings":";;;;;;;;;;MAEa,yBAAyB,GAAG,CACvC,GAAU,EACV,UAAoB,KACV;AACV,IAAA,MAAM,IAAI,GAAGA,mCAAe,CAAC,GAAG,CAAC,CAAC;AAElC,IAAA,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,KAAI;QACvC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAEvE,QAAA,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,KAAK,CAAC;AAChD,cAAE,IAAI;AACN,cAAE,gBAAgB;iBACf,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;AACrC,iBAAA,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;QAEpD,IAAI,YAAY,KAAK,SAAS,EAAE;AAC9B,YAAA,OAAO,YAAY,CAAC,gBAAgB,CAAC,CAAC;AACvC,SAAA;AACH,KAAC,CAAC,CAAC;AAEH,IAAA,OAAO,IAAI,CAAC;AACd;;;;"}
1
+ {"version":3,"file":"strip-properties-from-object.js","sources":["../../src/object/strip-properties-from-object.ts"],"sourcesContent":["import structuredClone from '@ungap/structured-clone';\n\nexport const stripPropertiesFromObject = <Output extends Record<any, any>, Input extends Record<any, any>>(\n obj: Input,\n properties: string[],\n): Output => {\n const copy = structuredClone(obj);\n\n properties.forEach((nestedPropertyStr) => {\n const nestedProperties = nestedPropertyStr.split('.');\n const propertyToRemove = nestedProperties[nestedProperties.length - 1];\n\n const nestedObject = nestedProperties.length === 1\n ? copy\n : nestedProperties\n .slice(0, nestedProperties.length - 1)\n .reduce((acc, property) => acc[property], copy);\n\n if (nestedObject) {\n delete nestedObject[propertyToRemove];\n }\n });\n\n return copy;\n};\n"],"names":["structuredClone"],"mappings":";;;;;;;;;;MAEa,yBAAyB,GAAG,CACvC,GAAU,EACV,UAAoB,KACV;AACV,IAAA,MAAM,IAAI,GAAGA,mCAAe,CAAC,GAAG,CAAC,CAAC;AAElC,IAAA,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,KAAI;QACvC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAEvE,QAAA,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,KAAK,CAAC;AAChD,cAAE,IAAI;AACN,cAAE,gBAAgB;iBACf,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;AACrC,iBAAA,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;AAEpD,QAAA,IAAI,YAAY,EAAE;AAChB,YAAA,OAAO,YAAY,CAAC,gBAAgB,CAAC,CAAC;AACvC,SAAA;AACH,KAAC,CAAC,CAAC;AAEH,IAAA,OAAO,IAAI,CAAC;AACd;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparted/shared-library",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "repository": "git@github.com:Sparted/shared-library.git",
5
5
  "author": "Thomas <duprethomasfr@gmail.com>",
6
6
  "license": "MIT",