Skip to content

Commit 59bbf6b

Browse files
author
GitHub Actions
committed
chore: Update dist
1 parent 6b1f3e4 commit 59bbf6b

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

dist/index.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,25 @@ function isEmptyValue(value) {
197197
return true;
198198
}
199199

200-
if (Array.isArray(value) && value.length === 0) {
200+
if (Array.isArray(value)) {
201+
for (var element of value) {
202+
if (!isEmptyValue(element)) {
203+
// the array has at least one non-empty element
204+
return false;
205+
}
206+
}
207+
// the array has no non-empty elements
201208
return true;
202209
}
203210

204-
if (typeof value === 'object' && Object.values(value).length === 0) {
211+
if (typeof value === 'object') {
212+
for (var childValue of Object.values(value)) {
213+
if (!isEmptyValue(childValue)) {
214+
// the object has at least one non-empty property
215+
return false;
216+
}
217+
}
218+
// the object has no non-empty property
205219
return true;
206220
}
207221

@@ -213,15 +227,8 @@ function emptyValueReplacer(_, value) {
213227
return undefined;
214228
}
215229

216-
if (typeof value === 'object') {
217-
for (var childValue of Object.values(value)) {
218-
if (!isEmptyValue(childValue)) {
219-
// the object has at least one non-empty property
220-
return value;
221-
}
222-
}
223-
// the object has no non-empty property
224-
return undefined;
230+
if (Array.isArray(value)) {
231+
return value.filter(e => !isEmptyValue(e));
225232
}
226233

227234
return value;

0 commit comments

Comments
 (0)