es-toolkit 1.18.0 → 1.19.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.
Files changed (157) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/_chunk/{rest-CXt9w3.js → curry-BmwJrK.js} +21 -0
  3. package/dist/_chunk/{isWeakSet-CogETi.js → isWeakSet-E_VMwB.js} +9 -3
  4. package/dist/_chunk/range-BXlMmn.js +68 -0
  5. package/dist/_chunk/{toMerged-DN1PPP.js → toMerged-Bzkqyz.js} +28 -46
  6. package/dist/_chunk/{zipWith-CYaH1Y.js → zipWith-B-5AMf.js} +1 -1
  7. package/dist/array/forEachRight.d.mts +23 -0
  8. package/dist/array/forEachRight.d.ts +23 -0
  9. package/dist/array/groupBy.mjs +1 -1
  10. package/dist/array/index.js +1 -1
  11. package/dist/array/orderBy.d.mts +1 -1
  12. package/dist/array/orderBy.d.ts +1 -1
  13. package/dist/array/sortBy.d.mts +1 -1
  14. package/dist/array/sortBy.d.ts +1 -1
  15. package/dist/array/unzip.d.mts +1 -1
  16. package/dist/array/unzip.d.ts +1 -1
  17. package/dist/array/zipObject.d.mts +1 -1
  18. package/dist/array/zipObject.d.ts +1 -1
  19. package/dist/browser.global.js +1 -1
  20. package/dist/browser.global.js.map +1 -1
  21. package/dist/compat/_internal/decimalAdjust.mjs +19 -0
  22. package/dist/compat/_internal/isDeepKey.mjs +1 -3
  23. package/dist/compat/_internal/normalizeForCase.mjs +5 -4
  24. package/dist/compat/_internal/toKey.mjs +2 -7
  25. package/dist/compat/array/flatten.d.mts +1 -1
  26. package/dist/compat/array/flatten.d.ts +1 -1
  27. package/dist/compat/array/flattenDepth.d.mts +1 -1
  28. package/dist/compat/array/flattenDepth.d.ts +1 -1
  29. package/dist/compat/array/indexOf.d.mts +1 -1
  30. package/dist/compat/array/indexOf.d.ts +1 -1
  31. package/dist/compat/array/orderBy.d.mts +1 -1
  32. package/dist/compat/array/orderBy.d.ts +1 -1
  33. package/dist/compat/array/orderBy.mjs +1 -1
  34. package/dist/compat/array/size.d.mts +1 -1
  35. package/dist/compat/array/size.d.ts +1 -1
  36. package/dist/compat/array/sortBy.d.mts +1 -1
  37. package/dist/compat/array/sortBy.d.ts +1 -1
  38. package/dist/compat/array/zipObjectDeep.d.mts +1 -1
  39. package/dist/compat/array/zipObjectDeep.d.ts +1 -1
  40. package/dist/compat/index.d.mts +20 -7
  41. package/dist/compat/index.d.ts +20 -7
  42. package/dist/compat/index.js +459 -137
  43. package/dist/compat/index.mjs +20 -7
  44. package/dist/compat/math/ceil.d.mts +15 -0
  45. package/dist/compat/math/ceil.d.ts +15 -0
  46. package/dist/compat/math/ceil.mjs +7 -0
  47. package/dist/compat/math/floor.d.mts +15 -0
  48. package/dist/compat/math/floor.d.ts +15 -0
  49. package/dist/compat/math/floor.mjs +7 -0
  50. package/dist/compat/math/round.d.mts +15 -0
  51. package/dist/compat/math/round.d.ts +15 -0
  52. package/dist/compat/math/round.mjs +7 -0
  53. package/dist/compat/object/fromPairs.d.mts +2 -2
  54. package/dist/compat/object/fromPairs.d.ts +2 -2
  55. package/dist/compat/object/get.d.mts +12 -12
  56. package/dist/compat/object/get.d.ts +12 -12
  57. package/dist/compat/object/get.mjs +54 -17
  58. package/dist/compat/object/has.mjs +1 -1
  59. package/dist/compat/object/mergeWith.mjs +14 -2
  60. package/dist/compat/object/omit.d.mts +34 -0
  61. package/dist/compat/object/omit.d.ts +34 -0
  62. package/dist/compat/object/omit.mjs +33 -0
  63. package/dist/compat/object/pick.d.mts +47 -0
  64. package/dist/compat/object/pick.d.ts +47 -0
  65. package/dist/compat/object/pick.mjs +38 -0
  66. package/dist/compat/object/set.mjs +1 -1
  67. package/dist/compat/object/unset.d.mts +20 -0
  68. package/dist/compat/object/unset.d.ts +20 -0
  69. package/dist/compat/object/unset.mjs +68 -0
  70. package/dist/compat/predicate/isInteger.d.mts +17 -0
  71. package/dist/compat/predicate/isInteger.d.ts +17 -0
  72. package/dist/compat/predicate/isInteger.mjs +5 -0
  73. package/dist/compat/predicate/isMatch.mjs +44 -4
  74. package/dist/compat/predicate/isNil.mjs +5 -0
  75. package/dist/compat/predicate/isObject.d.mts +4 -4
  76. package/dist/compat/predicate/isObject.d.ts +4 -4
  77. package/dist/compat/predicate/isSafeInteger.d.mts +20 -0
  78. package/dist/compat/predicate/isSafeInteger.d.ts +20 -0
  79. package/dist/compat/predicate/isSafeInteger.mjs +5 -0
  80. package/dist/compat/predicate/matchesProperty.mjs +12 -1
  81. package/dist/compat/string/kebabCase.d.mts +17 -0
  82. package/dist/compat/string/kebabCase.d.ts +17 -0
  83. package/dist/compat/string/kebabCase.mjs +9 -0
  84. package/dist/compat/string/lowerCase.d.mts +17 -0
  85. package/dist/compat/string/lowerCase.d.ts +17 -0
  86. package/dist/compat/string/lowerCase.mjs +8 -0
  87. package/dist/compat/string/snakeCase.d.mts +17 -0
  88. package/dist/compat/string/snakeCase.d.ts +17 -0
  89. package/dist/compat/string/snakeCase.mjs +8 -0
  90. package/dist/compat/string/startCase.d.mts +16 -0
  91. package/dist/compat/string/startCase.d.ts +16 -0
  92. package/dist/compat/string/startCase.mjs +8 -0
  93. package/dist/compat/string/trim.d.mts +16 -0
  94. package/dist/compat/string/trim.d.ts +16 -0
  95. package/dist/compat/string/trim.mjs +25 -0
  96. package/dist/compat/string/trimEnd.d.mts +17 -0
  97. package/dist/compat/string/trimEnd.d.ts +17 -0
  98. package/dist/compat/string/trimEnd.mjs +25 -0
  99. package/dist/compat/string/trimStart.d.mts +17 -0
  100. package/dist/compat/string/trimStart.d.ts +17 -0
  101. package/dist/compat/string/trimStart.mjs +25 -0
  102. package/dist/compat/util/toPath.d.mts +20 -0
  103. package/dist/compat/util/toPath.d.ts +20 -0
  104. package/dist/compat/util/toPath.mjs +37 -0
  105. package/dist/compat/util/toString.d.mts +19 -0
  106. package/dist/compat/util/toString.d.ts +19 -0
  107. package/dist/compat/util/toString.mjs +15 -0
  108. package/dist/function/curry.d.mts +127 -0
  109. package/dist/function/curry.d.ts +127 -0
  110. package/dist/function/curry.mjs +21 -0
  111. package/dist/function/index.d.mts +1 -0
  112. package/dist/function/index.d.ts +1 -0
  113. package/dist/function/index.js +15 -14
  114. package/dist/function/index.mjs +1 -0
  115. package/dist/index.d.mts +6 -0
  116. package/dist/index.d.ts +6 -0
  117. package/dist/index.js +40 -33
  118. package/dist/index.mjs +6 -0
  119. package/dist/math/index.js +8 -66
  120. package/dist/object/clone.mjs +28 -25
  121. package/dist/object/index.js +19 -3
  122. package/dist/object/pick.d.mts +1 -1
  123. package/dist/object/pick.d.ts +1 -1
  124. package/dist/predicate/index.d.mts +1 -0
  125. package/dist/predicate/index.d.ts +1 -0
  126. package/dist/predicate/index.js +6 -5
  127. package/dist/predicate/index.mjs +1 -0
  128. package/dist/predicate/isDate.d.mts +16 -0
  129. package/dist/predicate/isDate.d.ts +16 -0
  130. package/dist/predicate/isDate.mjs +5 -0
  131. package/dist/predicate/isNotNil.mjs +1 -1
  132. package/dist/string/capitalize.d.mts +1 -0
  133. package/dist/string/capitalize.d.ts +1 -0
  134. package/dist/string/index.d.mts +4 -0
  135. package/dist/string/index.d.ts +4 -0
  136. package/dist/string/index.js +65 -0
  137. package/dist/string/index.mjs +4 -0
  138. package/dist/string/startCase.d.mts +1 -1
  139. package/dist/string/startCase.d.ts +1 -1
  140. package/dist/string/trim.d.mts +15 -0
  141. package/dist/string/trim.d.ts +15 -0
  142. package/dist/string/trim.mjs +11 -0
  143. package/dist/string/trimEnd.d.mts +16 -0
  144. package/dist/string/trimEnd.d.ts +16 -0
  145. package/dist/string/trimEnd.mjs +22 -0
  146. package/dist/string/trimStart.d.mts +16 -0
  147. package/dist/string/trimStart.d.ts +16 -0
  148. package/dist/string/trimStart.mjs +22 -0
  149. package/dist/string/upperCase.d.mts +17 -0
  150. package/dist/string/upperCase.d.ts +17 -0
  151. package/dist/string/upperCase.mjs +15 -0
  152. package/package.json +1 -1
  153. package/dist/compat/_internal/isArrayMatch.mjs +0 -24
  154. package/dist/compat/_internal/isMapMatch.mjs +0 -18
  155. package/dist/compat/_internal/isSetMatch.mjs +0 -13
  156. package/dist/compat/_internal/toPath.mjs +0 -40
  157. package/dist/_chunk/{isTypedArray-Dsrnb1.js → isPlainObject-BIekvL.js} +8 -8
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const zipWith = require('../_chunk/zipWith-CYaH1Y.js');
5
+ const zipWith = require('../_chunk/zipWith-B-5AMf.js');
6
6
  const promise_index = require('../_chunk/index-BGZDR9.js');
7
- const rest$1 = require('../_chunk/rest-CXt9w3.js');
8
- const math_index = require('../math/index.js');
7
+ const curry = require('../_chunk/curry-BmwJrK.js');
8
+ const range = require('../_chunk/range-BXlMmn.js');
9
9
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
10
- const toMerged = require('../_chunk/toMerged-DN1PPP.js');
11
- const isWeakSet$1 = require('../_chunk/isWeakSet-CogETi.js');
12
- const isTypedArray$1 = require('../_chunk/isTypedArray-Dsrnb1.js');
10
+ const toMerged = require('../_chunk/toMerged-Bzkqyz.js');
11
+ const isWeakSet$1 = require('../_chunk/isWeakSet-E_VMwB.js');
12
+ const isPlainObject$1 = require('../_chunk/isPlainObject-BIekvL.js');
13
13
  const string_index = require('../string/index.js');
14
14
 
15
15
  function castArray(value) {
@@ -49,8 +49,6 @@ function fill(array, value, start = 0, end = array.length) {
49
49
  return zipWith.fill(array, value, start, end);
50
50
  }
51
51
 
52
- const IS_PLAIN = /^\w*$/;
53
- const IS_DEEP = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
54
52
  function isDeepKey(key) {
55
53
  switch (typeof key) {
56
54
  case 'number':
@@ -58,43 +56,39 @@ function isDeepKey(key) {
58
56
  return false;
59
57
  }
60
58
  case 'string': {
61
- return !IS_PLAIN.test(key) && IS_DEEP.test(key);
59
+ return key.includes('.') || key.includes('[') || key.includes(']');
62
60
  }
63
61
  }
64
62
  }
65
63
 
66
- function isSymbol(value) {
67
- return typeof value === 'symbol' || (value != null && value instanceof Symbol);
68
- }
69
-
70
64
  function toKey(value) {
71
- if (typeof value === 'string' || isSymbol(value)) {
72
- return value;
73
- }
74
- if (Object.is(value?.valueOf(), -0)) {
65
+ if (Object.is(value, -0)) {
75
66
  return '-0';
76
67
  }
77
- return `${value}`;
68
+ return value.toString();
78
69
  }
79
70
 
71
+ const DOTS_KEY = /^[\w.]+$/g;
72
+ const ESCAPE_REGEXP = /\\(\\)?/g;
73
+ const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
74
+ '|' +
75
+ '\\[(?:' +
76
+ '([^"\'][^[]*)' +
77
+ '|' +
78
+ '(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
79
+ ')\\]' +
80
+ '|' +
81
+ '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
80
82
  function toPath(deepKey) {
81
- const ESCAPE_REGEXP = /\\(\\)?/g;
82
- const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
83
- '|' +
84
- '\\[(?:' +
85
- '([^"\'][^[]*)' +
86
- '|' +
87
- '(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
88
- ')\\]' +
89
- '|' +
90
- '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
83
+ if (DOTS_KEY.test(deepKey)) {
84
+ return deepKey.split('.');
85
+ }
91
86
  const result = [];
92
87
  if (deepKey[0] === '.') {
93
88
  result.push('');
94
89
  }
95
- let match;
96
- let lastIndex = 0;
97
- while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {
90
+ const matches = deepKey.matchAll(PROPERTY_REGEXP);
91
+ for (const match of matches) {
98
92
  let key = match[0];
99
93
  const expr = match[1];
100
94
  const quote = match[2];
@@ -106,40 +100,71 @@ function toPath(deepKey) {
106
100
  key = expr;
107
101
  }
108
102
  result.push(key);
109
- if (PROPERTY_REGEXP.lastIndex === lastIndex) {
110
- PROPERTY_REGEXP.lastIndex++;
111
- }
112
- else {
113
- lastIndex = PROPERTY_REGEXP.lastIndex;
114
- }
115
103
  }
116
104
  return result;
117
105
  }
118
106
 
119
107
  function get(object, path, defaultValue) {
120
- let resolvedPath;
121
- if (Array.isArray(path)) {
122
- resolvedPath = path;
123
- }
124
- else if (typeof path === 'string' && isDeepKey(path) && object?.[path] == null) {
125
- resolvedPath = toPath(path);
108
+ if (object == null) {
109
+ return defaultValue;
126
110
  }
127
- else {
128
- resolvedPath = [path];
111
+ switch (typeof path) {
112
+ case 'string': {
113
+ const result = object[path];
114
+ if (result === undefined) {
115
+ if (isDeepKey(path)) {
116
+ return get(object, toPath(path), defaultValue);
117
+ }
118
+ else {
119
+ return defaultValue;
120
+ }
121
+ }
122
+ return result;
123
+ }
124
+ case 'number':
125
+ case 'symbol': {
126
+ if (typeof path === 'number') {
127
+ path = toKey(path);
128
+ }
129
+ const result = object[path];
130
+ if (result === undefined) {
131
+ return defaultValue;
132
+ }
133
+ return result;
134
+ }
135
+ default: {
136
+ if (Array.isArray(path)) {
137
+ return getWithPath(object, path, defaultValue);
138
+ }
139
+ if (Object.is(path?.valueOf(), -0)) {
140
+ path = '-0';
141
+ }
142
+ else {
143
+ path = String(path);
144
+ }
145
+ const result = object[path];
146
+ if (result === undefined) {
147
+ return defaultValue;
148
+ }
149
+ return result;
150
+ }
129
151
  }
130
- if (resolvedPath.length === 0) {
152
+ }
153
+ function getWithPath(object, path, defaultValue) {
154
+ if (path.length === 0) {
131
155
  return defaultValue;
132
156
  }
133
157
  let current = object;
134
- let index;
135
- for (index = 0; index < resolvedPath.length && current != null; index++) {
136
- const key = toKey(resolvedPath[index]);
137
- current = current[key];
158
+ for (let index = 0; index < path.length; index++) {
159
+ if (current == null) {
160
+ return defaultValue;
161
+ }
162
+ current = current[path[index]];
138
163
  }
139
- if (current === null && index === resolvedPath.length) {
140
- return current;
164
+ if (current === undefined) {
165
+ return defaultValue;
141
166
  }
142
- return current ?? defaultValue;
167
+ return current;
143
168
  }
144
169
 
145
170
  function property(path) {
@@ -148,52 +173,6 @@ function property(path) {
148
173
  };
149
174
  }
150
175
 
151
- function isArrayMatch(target, source) {
152
- if (source.length === 0) {
153
- return true;
154
- }
155
- if (!Array.isArray(target)) {
156
- return false;
157
- }
158
- const countedIndex = new Set();
159
- for (let i = 0; i < source.length; i++) {
160
- const sourceItem = source[i];
161
- const index = target.findIndex((targetItem, index) => {
162
- return isMatch(targetItem, sourceItem) && !countedIndex.has(index);
163
- });
164
- if (index === -1) {
165
- return false;
166
- }
167
- countedIndex.add(index);
168
- }
169
- return true;
170
- }
171
-
172
- function isMapMatch(target, source) {
173
- if (source.size === 0) {
174
- return true;
175
- }
176
- if (!(target instanceof Map)) {
177
- return false;
178
- }
179
- for (const [key, value] of source.entries()) {
180
- if (!isMatch(target.get(key), value)) {
181
- return false;
182
- }
183
- }
184
- return true;
185
- }
186
-
187
- function isSetMatch(target, source) {
188
- if (source.size === 0) {
189
- return true;
190
- }
191
- if (!(target instanceof Set)) {
192
- return false;
193
- }
194
- return isArrayMatch([...target], [...source]);
195
- }
196
-
197
176
  function isMatch(target, source) {
198
177
  if (source === target) {
199
178
  return true;
@@ -221,7 +200,7 @@ function isMatch(target, source) {
221
200
  }
222
201
  for (let i = 0; i < keys.length; i++) {
223
202
  const key = keys[i];
224
- if (!isTypedArray$1.isPrimitive(target) && !(key in target)) {
203
+ if (!isPlainObject$1.isPrimitive(target) && !(key in target)) {
225
204
  return false;
226
205
  }
227
206
  if (source[key] === undefined && target[key] !== undefined) {
@@ -244,6 +223,49 @@ function isMatch(target, source) {
244
223
  }
245
224
  }
246
225
  }
226
+ function isMapMatch(target, source) {
227
+ if (source.size === 0) {
228
+ return true;
229
+ }
230
+ if (!(target instanceof Map)) {
231
+ return false;
232
+ }
233
+ for (const [key, value] of source.entries()) {
234
+ if (!isMatch(target.get(key), value)) {
235
+ return false;
236
+ }
237
+ }
238
+ return true;
239
+ }
240
+ function isArrayMatch(target, source) {
241
+ if (source.length === 0) {
242
+ return true;
243
+ }
244
+ if (!Array.isArray(target)) {
245
+ return false;
246
+ }
247
+ const countedIndex = new Set();
248
+ for (let i = 0; i < source.length; i++) {
249
+ const sourceItem = source[i];
250
+ const index = target.findIndex((targetItem, index) => {
251
+ return isMatch(targetItem, sourceItem) && !countedIndex.has(index);
252
+ });
253
+ if (index === -1) {
254
+ return false;
255
+ }
256
+ countedIndex.add(index);
257
+ }
258
+ return true;
259
+ }
260
+ function isSetMatch(target, source) {
261
+ if (source.size === 0) {
262
+ return true;
263
+ }
264
+ if (!(target instanceof Set)) {
265
+ return false;
266
+ }
267
+ return isArrayMatch([...target], [...source]);
268
+ }
247
269
 
248
270
  function matches(source) {
249
271
  source = toMerged.cloneDeep(source);
@@ -325,7 +347,18 @@ function has(object, path) {
325
347
  }
326
348
 
327
349
  function matchesProperty(property, source) {
328
- property = Array.isArray(property) ? property : toKey(property);
350
+ switch (typeof property) {
351
+ case 'object': {
352
+ if (Object.is(property?.valueOf(), -0)) {
353
+ property = '-0';
354
+ }
355
+ break;
356
+ }
357
+ case 'number': {
358
+ property = toKey(property);
359
+ break;
360
+ }
361
+ }
329
362
  source = cloneDeep(source);
330
363
  return function (target) {
331
364
  const result = get(target, property);
@@ -519,6 +552,10 @@ const compareValues = (a, b, order) => {
519
552
  return 0;
520
553
  };
521
554
 
555
+ function isSymbol(value) {
556
+ return typeof value === 'symbol' || (value != null && value instanceof Symbol);
557
+ }
558
+
522
559
  const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
523
560
  const regexIsPlainProp = /^\w*$/;
524
561
  function isKey(value, object) {
@@ -684,7 +721,7 @@ function ary(func, n = func.length, guard) {
684
721
  if (Number.isNaN(n) || n < 0) {
685
722
  n = 0;
686
723
  }
687
- return rest$1.ary(func, n);
724
+ return curry.ary(func, n);
688
725
  }
689
726
 
690
727
  function bind(func, thisObj, ...partialArgs) {
@@ -744,7 +781,7 @@ function rest(func, start = func.length - 1) {
744
781
  if (Number.isNaN(start) || start < 0) {
745
782
  start = func.length - 1;
746
783
  }
747
- return rest$1.rest(func, start);
784
+ return curry.rest(func, start);
748
785
  }
749
786
 
750
787
  function spread(func, argsIndex = 0) {
@@ -782,6 +819,134 @@ function rearg(func, ...indices) {
782
819
  };
783
820
  }
784
821
 
822
+ function isNil(x) {
823
+ return x == null;
824
+ }
825
+
826
+ function pick(obj, ...keysArr) {
827
+ if (isNil(obj)) {
828
+ return {};
829
+ }
830
+ const result = {};
831
+ for (let keys of keysArr) {
832
+ switch (typeof keys) {
833
+ case 'object': {
834
+ if (!Array.isArray(keys)) {
835
+ keys = Array.from(keys);
836
+ }
837
+ break;
838
+ }
839
+ case 'string':
840
+ case 'symbol':
841
+ case 'number': {
842
+ keys = [keys];
843
+ break;
844
+ }
845
+ }
846
+ for (const key of keys) {
847
+ const value = get(obj, key);
848
+ if (typeof key === 'string' && Object.prototype.hasOwnProperty.call(obj, key)) {
849
+ result[key] = value;
850
+ }
851
+ else {
852
+ set(result, key, value);
853
+ }
854
+ }
855
+ }
856
+ return result;
857
+ }
858
+
859
+ function unset(obj, path) {
860
+ if (obj == null) {
861
+ return true;
862
+ }
863
+ switch (typeof path) {
864
+ case 'symbol':
865
+ case 'number':
866
+ case 'object': {
867
+ if (Array.isArray(path)) {
868
+ return unsetWithPath(obj, path);
869
+ }
870
+ if (typeof path === 'number') {
871
+ path = toKey(path);
872
+ }
873
+ else if (typeof path === 'object') {
874
+ if (Object.is(path?.valueOf(), -0)) {
875
+ path = '-0';
876
+ }
877
+ else {
878
+ path = String(path);
879
+ }
880
+ }
881
+ if (obj?.[path] === undefined) {
882
+ return true;
883
+ }
884
+ try {
885
+ delete obj[path];
886
+ return true;
887
+ }
888
+ catch {
889
+ return false;
890
+ }
891
+ }
892
+ case 'string': {
893
+ if (obj?.[path] === undefined && isDeepKey(path)) {
894
+ return unsetWithPath(obj, toPath(path));
895
+ }
896
+ try {
897
+ delete obj[path];
898
+ return true;
899
+ }
900
+ catch {
901
+ return false;
902
+ }
903
+ }
904
+ }
905
+ }
906
+ function unsetWithPath(obj, path) {
907
+ const parent = get(obj, path.slice(0, -1), obj);
908
+ const lastKey = path[path.length - 1];
909
+ if (parent?.[lastKey] === undefined) {
910
+ return true;
911
+ }
912
+ try {
913
+ delete parent[lastKey];
914
+ return true;
915
+ }
916
+ catch {
917
+ return false;
918
+ }
919
+ }
920
+
921
+ function omit(obj, ...keysArr) {
922
+ if (obj == null) {
923
+ return {};
924
+ }
925
+ const result = toMerged.cloneDeep(obj);
926
+ for (let i = 0; i < keysArr.length; i++) {
927
+ let keys = keysArr[i];
928
+ switch (typeof keys) {
929
+ case 'object': {
930
+ if (!Array.isArray(keys)) {
931
+ keys = Array.from(keys);
932
+ }
933
+ for (let j = 0; j < keys.length; j++) {
934
+ const key = keys[j];
935
+ unset(result, key);
936
+ }
937
+ break;
938
+ }
939
+ case 'string':
940
+ case 'symbol':
941
+ case 'number': {
942
+ unset(result, keys);
943
+ break;
944
+ }
945
+ }
946
+ }
947
+ return result;
948
+ }
949
+
785
950
  function mapKeys(object, getNewKey) {
786
951
  getNewKey = getNewKey ?? identity;
787
952
  switch (typeof getNewKey) {
@@ -841,7 +1006,7 @@ function isPlainObject(object) {
841
1006
  }
842
1007
 
843
1008
  function isTypedArray(x) {
844
- return isTypedArray$1.isTypedArray(x);
1009
+ return isPlainObject$1.isTypedArray(x);
845
1010
  }
846
1011
 
847
1012
  function mergeWith(object, ...otherArgs) {
@@ -868,7 +1033,7 @@ function mergeWithDeep(target, source, merge, stack) {
868
1033
  source[i] = source[i] ?? undefined;
869
1034
  }
870
1035
  }
871
- const sourceKeys = Object.keys(source);
1036
+ const sourceKeys = [...Object.keys(source), ...isWeakSet$1.getSymbols(source)];
872
1037
  for (let i = 0; i < sourceKeys.length; i++) {
873
1038
  const key = sourceKeys[i];
874
1039
  let sourceValue = source[key];
@@ -883,7 +1048,18 @@ function mergeWithDeep(target, source, merge, stack) {
883
1048
  sourceValue = cloneDeep(sourceValue);
884
1049
  }
885
1050
  if (Array.isArray(sourceValue)) {
886
- targetValue = typeof targetValue === 'object' ? Array.from(targetValue ?? []) : [];
1051
+ if (typeof targetValue === 'object') {
1052
+ const cloned = [];
1053
+ const targetKeys = Reflect.ownKeys(targetValue);
1054
+ for (let i = 0; i < targetKeys.length; i++) {
1055
+ const targetKey = targetKeys[i];
1056
+ cloned[targetKey] = targetValue[targetKey];
1057
+ }
1058
+ targetValue = cloned;
1059
+ }
1060
+ else {
1061
+ targetValue = [];
1062
+ }
887
1063
  }
888
1064
  const merged = merge(targetValue, sourceValue, key, target, source, stack);
889
1065
  if (merged != null) {
@@ -909,7 +1085,7 @@ function mergeWithDeep(target, source, merge, stack) {
909
1085
  }
910
1086
 
911
1087
  function merge(object, ...sources) {
912
- return mergeWith(object, ...sources, rest$1.noop);
1088
+ return mergeWith(object, ...sources, curry.noop);
913
1089
  }
914
1090
 
915
1091
  function isArrayLike(value) {
@@ -991,18 +1167,55 @@ function conforms(source) {
991
1167
  };
992
1168
  }
993
1169
 
1170
+ function isInteger(value) {
1171
+ return Number.isInteger(value);
1172
+ }
1173
+
1174
+ function isSafeInteger(value) {
1175
+ return Number.isSafeInteger(value);
1176
+ }
1177
+
1178
+ function toString(value) {
1179
+ if (value == null) {
1180
+ return '';
1181
+ }
1182
+ if (Array.isArray(value)) {
1183
+ return value.map(toString).join(',');
1184
+ }
1185
+ const result = String(value);
1186
+ if (result === '0' && Object.is(Number(value), -0)) {
1187
+ return '-0';
1188
+ }
1189
+ return result;
1190
+ }
1191
+
994
1192
  function normalizeForCase(str) {
995
- if (typeof str === 'object') {
996
- str = str.toString();
1193
+ if (typeof str !== 'string') {
1194
+ str = toString(str);
997
1195
  }
998
- str = str.replace(/['\u2019]/g, '');
999
- return str;
1196
+ return str.replace(/['\u2019]/g, '');
1000
1197
  }
1001
1198
 
1002
1199
  function camelCase(str) {
1003
1200
  return string_index.camelCase(normalizeForCase(str));
1004
1201
  }
1005
1202
 
1203
+ function kebabCase(str) {
1204
+ return string_index.kebabCase(normalizeForCase(str));
1205
+ }
1206
+
1207
+ function snakeCase(str) {
1208
+ return string_index.snakeCase(normalizeForCase(str));
1209
+ }
1210
+
1211
+ function startCase(str) {
1212
+ return string_index.startCase(normalizeForCase(str));
1213
+ }
1214
+
1215
+ function lowerCase(str) {
1216
+ return string_index.lowerCase(normalizeForCase(str));
1217
+ }
1218
+
1006
1219
  function startsWith(str, target, position = 0) {
1007
1220
  return str.startsWith(target, position);
1008
1221
  }
@@ -1023,6 +1236,72 @@ function repeat(str, n) {
1023
1236
  return str.repeat(n);
1024
1237
  }
1025
1238
 
1239
+ function trim(str, chars, guard) {
1240
+ if (str == null) {
1241
+ return '';
1242
+ }
1243
+ if (guard != null || chars == null) {
1244
+ return str.toString().trim();
1245
+ }
1246
+ switch (typeof chars) {
1247
+ case 'string': {
1248
+ return string_index.trim(str, chars.toString().split(''));
1249
+ }
1250
+ case 'object': {
1251
+ if (Array.isArray(chars)) {
1252
+ return string_index.trim(str, chars.map(x => x.toString()));
1253
+ }
1254
+ else {
1255
+ return string_index.trim(str, chars.toString().split(''));
1256
+ }
1257
+ }
1258
+ }
1259
+ }
1260
+
1261
+ function trimStart(str, chars, guard) {
1262
+ if (str == null) {
1263
+ return '';
1264
+ }
1265
+ if (guard != null || chars == null) {
1266
+ return str.toString().trimStart();
1267
+ }
1268
+ switch (typeof chars) {
1269
+ case 'string': {
1270
+ return string_index.trimStart(str, chars.toString().split(''));
1271
+ }
1272
+ case 'object': {
1273
+ if (Array.isArray(chars)) {
1274
+ return string_index.trimStart(str, chars.map(x => x.toString()));
1275
+ }
1276
+ else {
1277
+ return string_index.trimStart(str, chars.toString().split(''));
1278
+ }
1279
+ }
1280
+ }
1281
+ }
1282
+
1283
+ function trimEnd(str, chars, guard) {
1284
+ if (str == null) {
1285
+ return '';
1286
+ }
1287
+ if (guard != null || chars == null) {
1288
+ return str.toString().trimEnd();
1289
+ }
1290
+ switch (typeof chars) {
1291
+ case 'string': {
1292
+ return string_index.trimEnd(str, chars.toString().split(''));
1293
+ }
1294
+ case 'object': {
1295
+ if (Array.isArray(chars)) {
1296
+ return string_index.trimEnd(str, chars.map(x => x.toString()));
1297
+ }
1298
+ else {
1299
+ return string_index.trimEnd(str, chars.toString().split(''));
1300
+ }
1301
+ }
1302
+ }
1303
+ }
1304
+
1026
1305
  function max(items = []) {
1027
1306
  let maxElement = items[0];
1028
1307
  let max = undefined;
@@ -1047,6 +1326,36 @@ function min(items = []) {
1047
1326
  return minElement;
1048
1327
  }
1049
1328
 
1329
+ function decimalAdjust(type, number, precision = 0) {
1330
+ number = Number(number);
1331
+ if (Object.is(number, -0)) {
1332
+ number = '-0';
1333
+ }
1334
+ precision = Math.min(Number.parseInt(precision, 10), 292);
1335
+ if (precision) {
1336
+ const [magnitude, exponent = 0] = number.toString().split('e');
1337
+ let adjustedValue = Math[type](Number(`${magnitude}e${Number(exponent) + precision}`));
1338
+ if (Object.is(adjustedValue, -0)) {
1339
+ adjustedValue = '-0';
1340
+ }
1341
+ const [newMagnitude, newExponent = 0] = adjustedValue.toString().split('e');
1342
+ return Number(`${newMagnitude}e${Number(newExponent) - precision}`);
1343
+ }
1344
+ return Math[type](Number(number));
1345
+ }
1346
+
1347
+ function ceil(number, precision = 0) {
1348
+ return decimalAdjust('ceil', number, precision);
1349
+ }
1350
+
1351
+ function floor(number, precision = 0) {
1352
+ return decimalAdjust('floor', number, precision);
1353
+ }
1354
+
1355
+ function round(number, precision = 0) {
1356
+ return decimalAdjust('round', number, precision);
1357
+ }
1358
+
1050
1359
  function parseInt(string, radix = 0, guard) {
1051
1360
  if (guard) {
1052
1361
  radix = 0;
@@ -1109,25 +1418,25 @@ exports.TimeoutError = promise_index.TimeoutError;
1109
1418
  exports.delay = promise_index.delay;
1110
1419
  exports.timeout = promise_index.timeout;
1111
1420
  exports.withTimeout = promise_index.withTimeout;
1112
- exports.after = rest$1.after;
1113
- exports.before = rest$1.before;
1114
- exports.debounce = rest$1.debounce;
1115
- exports.memoize = rest$1.memoize;
1116
- exports.negate = rest$1.negate;
1117
- exports.noop = rest$1.noop;
1118
- exports.once = rest$1.once;
1119
- exports.partial = rest$1.partial;
1120
- exports.partialRight = rest$1.partialRight;
1121
- exports.throttle = rest$1.throttle;
1122
- exports.unary = rest$1.unary;
1123
- exports.clamp = math_index.clamp;
1124
- exports.inRange = math_index.inRange;
1125
- exports.mean = math_index.mean;
1126
- exports.meanBy = math_index.meanBy;
1127
- exports.range = math_index.range;
1128
- exports.round = math_index.round;
1129
- exports.sum = math_index.sum;
1130
- exports.sumBy = math_index.sumBy;
1421
+ exports.after = curry.after;
1422
+ exports.before = curry.before;
1423
+ exports.curry = curry.curry;
1424
+ exports.debounce = curry.debounce;
1425
+ exports.memoize = curry.memoize;
1426
+ exports.negate = curry.negate;
1427
+ exports.noop = curry.noop;
1428
+ exports.once = curry.once;
1429
+ exports.partial = curry.partial;
1430
+ exports.partialRight = curry.partialRight;
1431
+ exports.throttle = curry.throttle;
1432
+ exports.unary = curry.unary;
1433
+ exports.clamp = range.clamp;
1434
+ exports.inRange = range.inRange;
1435
+ exports.mean = range.mean;
1436
+ exports.meanBy = range.meanBy;
1437
+ exports.range = range.range;
1438
+ exports.sum = range.sum;
1439
+ exports.sumBy = range.sumBy;
1131
1440
  exports.random = randomInt.random;
1132
1441
  exports.randomInt = randomInt.randomInt;
1133
1442
  exports.clone = toMerged.clone;
@@ -1135,11 +1444,10 @@ exports.cloneDeep = toMerged.cloneDeep;
1135
1444
  exports.flattenObject = toMerged.flattenObject;
1136
1445
  exports.invert = toMerged.invert;
1137
1446
  exports.isObjectLike = toMerged.isObjectLike;
1138
- exports.omit = toMerged.omit;
1139
1447
  exports.omitBy = toMerged.omitBy;
1140
- exports.pick = toMerged.pick;
1141
1448
  exports.pickBy = toMerged.pickBy;
1142
1449
  exports.toMerged = toMerged.toMerged;
1450
+ exports.isDate = isWeakSet$1.isDate;
1143
1451
  exports.isEqual = isWeakSet$1.isEqual;
1144
1452
  exports.isFunction = isWeakSet$1.isFunction;
1145
1453
  exports.isLength = isWeakSet$1.isLength;
@@ -1147,19 +1455,16 @@ exports.isNil = isWeakSet$1.isNil;
1147
1455
  exports.isNotNil = isWeakSet$1.isNotNil;
1148
1456
  exports.isNull = isWeakSet$1.isNull;
1149
1457
  exports.isUndefined = isWeakSet$1.isUndefined;
1150
- exports.isPrimitive = isTypedArray$1.isPrimitive;
1458
+ exports.isPrimitive = isPlainObject$1.isPrimitive;
1151
1459
  exports.capitalize = string_index.capitalize;
1152
1460
  exports.deburr = string_index.deburr;
1153
1461
  exports.escape = string_index.escape;
1154
1462
  exports.escapeRegExp = string_index.escapeRegExp;
1155
- exports.kebabCase = string_index.kebabCase;
1156
- exports.lowerCase = string_index.lowerCase;
1157
1463
  exports.lowerFirst = string_index.lowerFirst;
1158
1464
  exports.pad = string_index.pad;
1159
1465
  exports.pascalCase = string_index.pascalCase;
1160
- exports.snakeCase = string_index.snakeCase;
1161
- exports.startCase = string_index.startCase;
1162
1466
  exports.unescape = string_index.unescape;
1467
+ exports.upperCase = string_index.upperCase;
1163
1468
  exports.upperFirst = string_index.upperFirst;
1164
1469
  exports.ary = ary;
1165
1470
  exports.attempt = attempt;
@@ -1167,6 +1472,7 @@ exports.bind = bind;
1167
1472
  exports.bindKey = bindKey;
1168
1473
  exports.camelCase = camelCase;
1169
1474
  exports.castArray = castArray;
1475
+ exports.ceil = ceil;
1170
1476
  exports.chunk = chunk;
1171
1477
  exports.concat = concat;
1172
1478
  exports.conforms = conforms;
@@ -1180,6 +1486,7 @@ exports.findLastIndex = findLastIndex;
1180
1486
  exports.flatten = flatten;
1181
1487
  exports.flattenDeep = flattenDeep;
1182
1488
  exports.flattenDepth = flattenDepth;
1489
+ exports.floor = floor;
1183
1490
  exports.fromPairs = fromPairs;
1184
1491
  exports.get = get;
1185
1492
  exports.has = has;
@@ -1188,16 +1495,20 @@ exports.isArguments = isArguments;
1188
1495
  exports.isArray = isArray;
1189
1496
  exports.isArrayLike = isArrayLike;
1190
1497
  exports.isBoolean = isBoolean;
1498
+ exports.isInteger = isInteger;
1191
1499
  exports.isMatch = isMatch;
1192
1500
  exports.isObject = isObject;
1193
1501
  exports.isPlainObject = isPlainObject;
1194
1502
  exports.isRegExp = isRegExp;
1503
+ exports.isSafeInteger = isSafeInteger;
1195
1504
  exports.isString = isString;
1196
1505
  exports.isSymbol = isSymbol;
1197
1506
  exports.isTypedArray = isTypedArray;
1198
1507
  exports.isWeakMap = isWeakMap;
1199
1508
  exports.isWeakSet = isWeakSet;
1200
1509
  exports.join = join;
1510
+ exports.kebabCase = kebabCase;
1511
+ exports.lowerCase = lowerCase;
1201
1512
  exports.mapKeys = mapKeys;
1202
1513
  exports.mapValues = mapValues;
1203
1514
  exports.matches = matches;
@@ -1206,18 +1517,29 @@ exports.max = max;
1206
1517
  exports.merge = merge;
1207
1518
  exports.mergeWith = mergeWith;
1208
1519
  exports.min = min;
1520
+ exports.omit = omit;
1209
1521
  exports.orderBy = orderBy;
1210
1522
  exports.padEnd = padEnd;
1211
1523
  exports.padStart = padStart;
1212
1524
  exports.parseInt = parseInt;
1525
+ exports.pick = pick;
1213
1526
  exports.property = property;
1214
1527
  exports.rearg = rearg;
1215
1528
  exports.repeat = repeat;
1216
1529
  exports.rest = rest;
1530
+ exports.round = round;
1217
1531
  exports.set = set;
1218
1532
  exports.size = size;
1533
+ exports.snakeCase = snakeCase;
1219
1534
  exports.some = some;
1220
1535
  exports.sortBy = sortBy;
1221
1536
  exports.spread = spread;
1537
+ exports.startCase = startCase;
1222
1538
  exports.startsWith = startsWith;
1539
+ exports.toPath = toPath;
1540
+ exports.toString = toString;
1541
+ exports.trim = trim;
1542
+ exports.trimEnd = trimEnd;
1543
+ exports.trimStart = trimStart;
1544
+ exports.unset = unset;
1223
1545
  exports.zipObjectDeep = zipObjectDeep;