@splendidlabz/utils 1.15.1 → 1.16.0

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.
@@ -171,18 +171,26 @@ function isPlainObject(x) {
171
171
  return prototype === Object.prototype || prototype === null;
172
172
  }
173
173
 
174
+ // src/lib/objects/empty.js
175
+ function isEmpty(value) {
176
+ if (value === null || value === void 0) return true;
177
+ if (typeof value === "string" || Array.isArray(value)) {
178
+ return value.length === 0;
179
+ }
180
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
181
+ if (typeof value.size === "number") return value.size === 0;
182
+ return false;
183
+ }
184
+
174
185
  // src/lib/objects/omit-empty.js
175
186
  function omitEmpty(obj, options = {}) {
176
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
187
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
177
188
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
178
189
  const result = Array.isArray(obj) ? [] : {};
179
190
  for (const [key, value] of Object.entries(obj)) {
180
- if (value === null || value === void 0 || value === "") continue;
181
- if (omitFalsey && !value) continue;
182
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
183
- continue;
184
- }
185
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
191
+ if (isEmpty(value)) continue;
192
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
193
+ const filteredValue = walk ? omitEmpty(value) : value;
186
194
  if (Array.isArray(result)) result.push(filteredValue);
187
195
  else result[key] = filteredValue;
188
196
  }
@@ -30,18 +30,26 @@ function isPlainObject(x) {
30
30
  return prototype === Object.prototype || prototype === null;
31
31
  }
32
32
 
33
+ // src/lib/objects/empty.js
34
+ function isEmpty(value) {
35
+ if (value === null || value === void 0) return true;
36
+ if (typeof value === "string" || Array.isArray(value)) {
37
+ return value.length === 0;
38
+ }
39
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
40
+ if (typeof value.size === "number") return value.size === 0;
41
+ return false;
42
+ }
43
+
33
44
  // src/lib/objects/omit-empty.js
34
45
  function omitEmpty(obj, options = {}) {
35
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
46
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
36
47
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
37
48
  const result = Array.isArray(obj) ? [] : {};
38
49
  for (const [key, value] of Object.entries(obj)) {
39
- if (value === null || value === void 0 || value === "") continue;
40
- if (omitFalsey && !value) continue;
41
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
42
- continue;
43
- }
44
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
50
+ if (isEmpty(value)) continue;
51
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
52
+ const filteredValue = walk ? omitEmpty(value) : value;
45
53
  if (Array.isArray(result)) result.push(filteredValue);
46
54
  else result[key] = filteredValue;
47
55
  }
@@ -313,18 +313,26 @@ function isPlainObject(x) {
313
313
  return prototype === Object.prototype || prototype === null;
314
314
  }
315
315
 
316
+ // src/lib/objects/empty.js
317
+ function isEmpty(value) {
318
+ if (value === null || value === void 0) return true;
319
+ if (typeof value === "string" || Array.isArray(value)) {
320
+ return value.length === 0;
321
+ }
322
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
323
+ if (typeof value.size === "number") return value.size === 0;
324
+ return false;
325
+ }
326
+
316
327
  // src/lib/objects/omit-empty.js
317
328
  function omitEmpty(obj, options = {}) {
318
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
329
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
319
330
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
320
331
  const result = Array.isArray(obj) ? [] : {};
321
332
  for (const [key, value] of Object.entries(obj)) {
322
- if (value === null || value === void 0 || value === "") continue;
323
- if (omitFalsey && !value) continue;
324
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
325
- continue;
326
- }
327
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
333
+ if (isEmpty(value)) continue;
334
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
335
+ const filteredValue = walk ? omitEmpty(value) : value;
328
336
  if (Array.isArray(result)) result.push(filteredValue);
329
337
  else result[key] = filteredValue;
330
338
  }
@@ -835,14 +835,17 @@ function camelCaseKeys(obj) {
835
835
  }
836
836
 
837
837
  // src/lib/objects/empty.js
838
- function isEmpty(obj) {
839
- if (typeof obj === "undefined") return true;
840
- if (obj === null) return true;
841
- if (Array.isArray(obj)) return obj.length === 0;
842
- return Object.keys(obj).length === 0;
838
+ function isEmpty(value) {
839
+ if (value === null || value === void 0) return true;
840
+ if (typeof value === "string" || Array.isArray(value)) {
841
+ return value.length === 0;
842
+ }
843
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
844
+ if (typeof value.size === "number") return value.size === 0;
845
+ return false;
843
846
  }
844
- function notEmpty(obj) {
845
- return !isEmpty(obj);
847
+ function notEmpty(value) {
848
+ return !isEmpty(value);
846
849
  }
847
850
 
848
851
  // src/lib/objects/equal.js
@@ -974,16 +977,13 @@ function parseJSON(value, defaultValue = {}) {
974
977
 
975
978
  // src/lib/objects/omit-empty.js
976
979
  function omitEmpty(obj, options = {}) {
977
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
980
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
978
981
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
979
982
  const result = Array.isArray(obj) ? [] : {};
980
983
  for (const [key, value] of Object.entries(obj)) {
981
- if (value === null || value === void 0 || value === "") continue;
982
- if (omitFalsey && !value) continue;
983
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
984
- continue;
985
- }
986
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
984
+ if (isEmpty(value)) continue;
985
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
986
+ const filteredValue = walk ? omitEmpty(value) : value;
987
987
  if (Array.isArray(result)) result.push(filteredValue);
988
988
  else result[key] = filteredValue;
989
989
  }
@@ -23,14 +23,26 @@ __export(empty_exports, {
23
23
  notEmpty: () => notEmpty
24
24
  });
25
25
  module.exports = __toCommonJS(empty_exports);
26
- function isEmpty(obj) {
27
- if (typeof obj === "undefined") return true;
28
- if (obj === null) return true;
29
- if (Array.isArray(obj)) return obj.length === 0;
30
- return Object.keys(obj).length === 0;
26
+
27
+ // src/lib/checks.js
28
+ function isPlainObject(x) {
29
+ if (typeof x !== "object" || x === null) return false;
30
+ const prototype = Object.getPrototypeOf(x);
31
+ return prototype === Object.prototype || prototype === null;
32
+ }
33
+
34
+ // src/lib/objects/empty.js
35
+ function isEmpty(value) {
36
+ if (value === null || value === void 0) return true;
37
+ if (typeof value === "string" || Array.isArray(value)) {
38
+ return value.length === 0;
39
+ }
40
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
41
+ if (typeof value.size === "number") return value.size === 0;
42
+ return false;
31
43
  }
32
- function notEmpty(obj) {
33
- return !isEmpty(obj);
44
+ function notEmpty(value) {
45
+ return !isEmpty(value);
34
46
  }
35
47
  // Annotate the CommonJS export names for ESM import in node:
36
48
  0 && (module.exports = {
@@ -114,15 +114,28 @@ function camelCaseKeys(obj) {
114
114
  return result;
115
115
  }
116
116
 
117
+ // src/lib/checks.js
118
+ function isObject(x) {
119
+ return typeof x === "object" && !Array.isArray(x) && x !== null;
120
+ }
121
+ function isPlainObject(x) {
122
+ if (typeof x !== "object" || x === null) return false;
123
+ const prototype = Object.getPrototypeOf(x);
124
+ return prototype === Object.prototype || prototype === null;
125
+ }
126
+
117
127
  // src/lib/objects/empty.js
118
- function isEmpty(obj) {
119
- if (typeof obj === "undefined") return true;
120
- if (obj === null) return true;
121
- if (Array.isArray(obj)) return obj.length === 0;
122
- return Object.keys(obj).length === 0;
128
+ function isEmpty(value) {
129
+ if (value === null || value === void 0) return true;
130
+ if (typeof value === "string" || Array.isArray(value)) {
131
+ return value.length === 0;
132
+ }
133
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
134
+ if (typeof value.size === "number") return value.size === 0;
135
+ return false;
123
136
  }
124
- function notEmpty(obj) {
125
- return !isEmpty(obj);
137
+ function notEmpty(value) {
138
+ return !isEmpty(value);
126
139
  }
127
140
 
128
141
  // src/lib/objects/equal.js
@@ -246,16 +259,6 @@ function extendObject(object) {
246
259
  return { orig, extended };
247
260
  }
248
261
 
249
- // src/lib/checks.js
250
- function isObject(x) {
251
- return typeof x === "object" && !Array.isArray(x) && x !== null;
252
- }
253
- function isPlainObject(x) {
254
- if (typeof x !== "object" || x === null) return false;
255
- const prototype = Object.getPrototypeOf(x);
256
- return prototype === Object.prototype || prototype === null;
257
- }
258
-
259
262
  // src/lib/objects/flatten.js
260
263
  function flattenObject(obj, { separator, prefix = "" }) {
261
264
  return Object.entries(obj).reduce((acc, [key, value]) => {
@@ -297,16 +300,13 @@ function getNestedValue(object, path) {
297
300
 
298
301
  // src/lib/objects/omit-empty.js
299
302
  function omitEmpty(obj, options = {}) {
300
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
303
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
301
304
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
302
305
  const result = Array.isArray(obj) ? [] : {};
303
306
  for (const [key, value] of Object.entries(obj)) {
304
- if (value === null || value === void 0 || value === "") continue;
305
- if (omitFalsey && !value) continue;
306
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
307
- continue;
308
- }
309
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
307
+ if (isEmpty(value)) continue;
308
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
309
+ const filteredValue = walk ? omitEmpty(value) : value;
310
310
  if (Array.isArray(result)) result.push(filteredValue);
311
311
  else result[key] = filteredValue;
312
312
  }
@@ -92,18 +92,26 @@ function isPlainObject(x) {
92
92
  return prototype === Object.prototype || prototype === null;
93
93
  }
94
94
 
95
+ // src/lib/objects/empty.js
96
+ function isEmpty(value) {
97
+ if (value === null || value === void 0) return true;
98
+ if (typeof value === "string" || Array.isArray(value)) {
99
+ return value.length === 0;
100
+ }
101
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
102
+ if (typeof value.size === "number") return value.size === 0;
103
+ return false;
104
+ }
105
+
95
106
  // src/lib/objects/omit-empty.js
96
107
  function omitEmpty(obj, options = {}) {
97
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
108
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
98
109
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
99
110
  const result = Array.isArray(obj) ? [] : {};
100
111
  for (const [key, value] of Object.entries(obj)) {
101
- if (value === null || value === void 0 || value === "") continue;
102
- if (omitFalsey && !value) continue;
103
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
104
- continue;
105
- }
106
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
112
+ if (isEmpty(value)) continue;
113
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
114
+ const filteredValue = walk ? omitEmpty(value) : value;
107
115
  if (Array.isArray(result)) result.push(filteredValue);
108
116
  else result[key] = filteredValue;
109
117
  }
@@ -30,18 +30,26 @@ function isPlainObject(x) {
30
30
  return prototype === Object.prototype || prototype === null;
31
31
  }
32
32
 
33
+ // src/lib/objects/empty.js
34
+ function isEmpty(value) {
35
+ if (value === null || value === void 0) return true;
36
+ if (typeof value === "string" || Array.isArray(value)) {
37
+ return value.length === 0;
38
+ }
39
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
40
+ if (typeof value.size === "number") return value.size === 0;
41
+ return false;
42
+ }
43
+
33
44
  // src/lib/objects/omit-empty.js
34
45
  function omitEmpty(obj, options = {}) {
35
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
46
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
36
47
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
37
48
  const result = Array.isArray(obj) ? [] : {};
38
49
  for (const [key, value] of Object.entries(obj)) {
39
- if (value === null || value === void 0 || value === "") continue;
40
- if (omitFalsey && !value) continue;
41
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
42
- continue;
43
- }
44
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
50
+ if (isEmpty(value)) continue;
51
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
52
+ const filteredValue = walk ? omitEmpty(value) : value;
45
53
  if (Array.isArray(result)) result.push(filteredValue);
46
54
  else result[key] = filteredValue;
47
55
  }
@@ -30,18 +30,26 @@ function isPlainObject(x) {
30
30
  return prototype === Object.prototype || prototype === null;
31
31
  }
32
32
 
33
+ // src/lib/objects/empty.js
34
+ function isEmpty(value) {
35
+ if (value === null || value === void 0) return true;
36
+ if (typeof value === "string" || Array.isArray(value)) {
37
+ return value.length === 0;
38
+ }
39
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
40
+ if (typeof value.size === "number") return value.size === 0;
41
+ return false;
42
+ }
43
+
33
44
  // src/lib/objects/omit-empty.js
34
45
  function omitEmpty(obj, options = {}) {
35
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
46
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
36
47
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
37
48
  const result = Array.isArray(obj) ? [] : {};
38
49
  for (const [key, value] of Object.entries(obj)) {
39
- if (value === null || value === void 0 || value === "") continue;
40
- if (omitFalsey && !value) continue;
41
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
42
- continue;
43
- }
44
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
50
+ if (isEmpty(value)) continue;
51
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
52
+ const filteredValue = walk ? omitEmpty(value) : value;
45
53
  if (Array.isArray(result)) result.push(filteredValue);
46
54
  else result[key] = filteredValue;
47
55
  }
@@ -30,18 +30,26 @@ function isPlainObject(x) {
30
30
  return prototype === Object.prototype || prototype === null;
31
31
  }
32
32
 
33
+ // src/lib/objects/empty.js
34
+ function isEmpty(value) {
35
+ if (value === null || value === void 0) return true;
36
+ if (typeof value === "string" || Array.isArray(value)) {
37
+ return value.length === 0;
38
+ }
39
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
40
+ if (typeof value.size === "number") return value.size === 0;
41
+ return false;
42
+ }
43
+
33
44
  // src/lib/objects/omit-empty.js
34
45
  function omitEmpty(obj, options = {}) {
35
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
46
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
36
47
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
37
48
  const result = Array.isArray(obj) ? [] : {};
38
49
  for (const [key, value] of Object.entries(obj)) {
39
- if (value === null || value === void 0 || value === "") continue;
40
- if (omitFalsey && !value) continue;
41
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
42
- continue;
43
- }
44
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
50
+ if (isEmpty(value)) continue;
51
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
52
+ const filteredValue = walk ? omitEmpty(value) : value;
45
53
  if (Array.isArray(result)) result.push(filteredValue);
46
54
  else result[key] = filteredValue;
47
55
  }
@@ -40,18 +40,26 @@ function isPlainObject(x) {
40
40
  return prototype === Object.prototype || prototype === null;
41
41
  }
42
42
 
43
+ // src/lib/objects/empty.js
44
+ function isEmpty(value) {
45
+ if (value === null || value === void 0) return true;
46
+ if (typeof value === "string" || Array.isArray(value)) {
47
+ return value.length === 0;
48
+ }
49
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
50
+ if (typeof value.size === "number") return value.size === 0;
51
+ return false;
52
+ }
53
+
43
54
  // src/lib/objects/omit-empty.js
44
55
  function omitEmpty(obj, options = {}) {
45
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
56
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
46
57
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
47
58
  const result = Array.isArray(obj) ? [] : {};
48
59
  for (const [key, value] of Object.entries(obj)) {
49
- if (value === null || value === void 0 || value === "") continue;
50
- if (omitFalsey && !value) continue;
51
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
52
- continue;
53
- }
54
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
60
+ if (isEmpty(value)) continue;
61
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
62
+ const filteredValue = walk ? omitEmpty(value) : value;
55
63
  if (Array.isArray(result)) result.push(filteredValue);
56
64
  else result[key] = filteredValue;
57
65
  }
@@ -1,11 +1,15 @@
1
- function isEmpty(obj) {
2
- if (typeof obj === "undefined") return true;
3
- if (obj === null) return true;
4
- if (Array.isArray(obj)) return obj.length === 0;
5
- return Object.keys(obj).length === 0;
1
+ import { isPlainObject } from "../checks.js";
2
+ function isEmpty(value) {
3
+ if (value === null || value === void 0) return true;
4
+ if (typeof value === "string" || Array.isArray(value)) {
5
+ return value.length === 0;
6
+ }
7
+ if (isPlainObject(value)) return Object.keys(value).length === 0;
8
+ if (typeof value.size === "number") return value.size === 0;
9
+ return false;
6
10
  }
7
- function notEmpty(obj) {
8
- return !isEmpty(obj);
11
+ function notEmpty(value) {
12
+ return !isEmpty(value);
9
13
  }
10
14
  export {
11
15
  isEmpty,
@@ -1,15 +1,13 @@
1
1
  import { isPlainObject } from "../checks.js";
2
+ import { isEmpty } from "./empty.js";
2
3
  function omitEmpty(obj, options = {}) {
3
- const { shallow = false, omitFalsey = false } = typeof options === "boolean" ? { shallow: options } : options;
4
+ const { shallow = false } = typeof options === "boolean" ? { shallow: options } : options;
4
5
  if (!isPlainObject(obj) && !Array.isArray(obj)) return obj;
5
6
  const result = Array.isArray(obj) ? [] : {};
6
7
  for (const [key, value] of Object.entries(obj)) {
7
- if (value === null || value === void 0 || value === "") continue;
8
- if (omitFalsey && !value) continue;
9
- if ((isPlainObject(value) || Array.isArray(value)) && Object.keys(value).length === 0) {
10
- continue;
11
- }
12
- const filteredValue = shallow ? value : omitEmpty(value, { omitFalsey });
8
+ if (isEmpty(value)) continue;
9
+ const walk = !shallow && (isPlainObject(value) || Array.isArray(value));
10
+ const filteredValue = walk ? omitEmpty(value) : value;
13
11
  if (Array.isArray(result)) result.push(filteredValue);
14
12
  else result[key] = filteredValue;
15
13
  }
@@ -1,4 +1,21 @@
1
- declare function isEmpty(obj: any): boolean;
2
- declare function notEmpty(obj: any): boolean;
1
+ /**
2
+ * Says whether a value holds nothing — absence, or a container with nothing in it. `0` and `false` are answers, not emptiness.
3
+ * @param {any} value - The value to check
4
+ * @returns {boolean} True where there is nothing there
5
+ * @example
6
+ * isEmpty(null) // true
7
+ * isEmpty([]) // true
8
+ * isEmpty(new Map()) // true
9
+ * isEmpty(0) // false
10
+ * isEmpty(false) // false
11
+ * isEmpty(new Date()) // false
12
+ */
13
+ declare function isEmpty(value: any): boolean;
14
+ /**
15
+ * Says whether a value holds something. The inverse of {@link isEmpty}.
16
+ * @param {any} value - The value to check
17
+ * @returns {boolean} True where there is something there
18
+ */
19
+ declare function notEmpty(value: any): boolean;
3
20
 
4
21
  export { isEmpty, notEmpty };
@@ -1,17 +1,15 @@
1
1
  /**
2
- * Drop the keys holding nothing — null, undefined, an empty string, an empty object or an empty array.
2
+ * Drop the keys holding nothing, as {@link isEmpty} reads it.
3
3
  *
4
4
  * @template {object} T
5
5
  * @overload
6
6
  * @param {T} obj Object to filter.
7
7
  * @param {object} [options]
8
8
  * @param {boolean} [options.shallow=false] Leave nested values alone.
9
- * @param {boolean} [options.omitFalsey=false] Drop 0, false and NaN too.
10
9
  * @returns {T extends readonly (infer E)[] ? NonNullable<E>[] : Partial<T>} A copy without the empty keys. An array answers with an array, its element type stripped of `null` and `undefined` — the two entries this always drops.
11
10
  */
12
11
  declare function omitEmpty<T extends unknown>(obj: T, options?: {
13
12
  shallow?: boolean;
14
- omitFalsey?: boolean;
15
13
  }): T extends readonly (infer E)[] ? NonNullable<E>[] : Partial<T>;
16
14
  /**
17
15
  * Drop the keys holding nothing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splendidlabz/utils",
3
- "version": "1.15.1",
3
+ "version": "1.16.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "homepage": "https://splendidlabz.com/docs/utils",