Skip to content

Commit

Permalink
types: fix undefined check
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Sep 26, 2024
1 parent 04fb7c1 commit 2d94cc4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function skipEmpty(val: any) {
if (Array.isArray(val)) {
for (let i = val.length - 1; i >= 0; i--) {
val[i] = skipEmpty(val[i]);
if (!val[i]) {
if (val[i] === undefined) {
val.splice(i, 1);
}
}
Expand All @@ -163,7 +163,7 @@ function skipEmpty(val: any) {
const keys = Object.keys(val);
for (let i = keys.length - 1; i >= 0; i--) {
val[keys[i]] = skipEmpty(val[keys[i]]);
if (!val[keys[i]]) {
if (val[keys[i]] === undefined) {
delete val[keys[i]];
}
}
Expand Down

0 comments on commit 2d94cc4

Please sign in to comment.