@trayio/commons
Advanced tools
Comparing version 2.9.0 to 2.10.0
@@ -9,4 +9,5 @@ import * as E from 'fp-ts/lib/Either'; | ||
private removeNullValuesIfPresent; | ||
private removeNullFromArrayIfPresent; | ||
private removeNullFromObjectIfPresent; | ||
} | ||
//# sourceMappingURL=RemoveNullValuesCodec.d.ts.map |
@@ -45,4 +45,15 @@ "use strict"; | ||
} | ||
if (Array.isArray(value)) { | ||
return this.removeNullFromArrayIfPresent(value); | ||
} | ||
return value; | ||
} | ||
removeNullFromArrayIfPresent(value) { | ||
return value.reduce((acc, propertyValue) => { | ||
if (propertyValue == null) { | ||
return acc; | ||
} | ||
return [...acc, this.removeNullValuesIfPresent(propertyValue)]; | ||
}, []); | ||
} | ||
removeNullFromObjectIfPresent(value) { | ||
@@ -57,2 +68,6 @@ return Object.entries(value).reduce((acc, [key, propertyValue]) => { | ||
} | ||
if (Array.isArray(propertyValue)) { | ||
const nestedArray = this.removeNullFromArrayIfPresent(propertyValue); | ||
return Object.assign(Object.assign({}, acc), { [key]: nestedArray }); | ||
} | ||
return Object.assign(Object.assign({}, acc), { [key]: propertyValue }); | ||
@@ -59,0 +74,0 @@ }, {}); |
{ | ||
"name": "@trayio/commons", | ||
"version": "2.9.0", | ||
"version": "2.10.0", | ||
"description": "Extensions to the standard/core libraries and basic features", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114439
2074