es-toolkit 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.
Files changed (99) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/_chunk/{initial-CBsbzo.js → initial-y0QrPY.js} +28 -0
  3. package/dist/_chunk/{isFunction-D0hq6d.js → isFunction-aCEz9d.js} +5 -7
  4. package/dist/_chunk/{isObjectLike-BeLCsr.js → toMerged-BGwYW5.js} +25 -0
  5. package/dist/_internal/compareValues.mjs +11 -0
  6. package/dist/array/index.d.mts +1 -0
  7. package/dist/array/index.d.ts +1 -0
  8. package/dist/array/index.js +3 -11
  9. package/dist/array/index.mjs +1 -0
  10. package/dist/array/orderBy.mjs +2 -9
  11. package/dist/array/sortBy.d.mts +35 -0
  12. package/dist/array/sortBy.d.ts +35 -0
  13. package/dist/array/sortBy.mjs +19 -0
  14. package/dist/browser.global.js +1 -1
  15. package/dist/browser.global.js.map +1 -1
  16. package/dist/compat/_internal/getSymbols.mjs +1 -2
  17. package/dist/compat/_internal/toKey.mjs +13 -0
  18. package/dist/compat/array/find.d.mts +122 -0
  19. package/dist/compat/array/find.d.ts +122 -0
  20. package/dist/compat/array/find.mjs +42 -0
  21. package/dist/compat/array/findIndex.d.mts +62 -0
  22. package/dist/compat/array/findIndex.d.ts +62 -0
  23. package/dist/compat/array/findIndex.mjs +26 -0
  24. package/dist/compat/array/indexOf.d.mts +21 -0
  25. package/dist/compat/array/indexOf.d.ts +21 -0
  26. package/dist/compat/array/indexOf.mjs +20 -0
  27. package/dist/compat/function/ary.d.mts +2 -1
  28. package/dist/compat/function/ary.d.ts +2 -1
  29. package/dist/compat/function/bind.d.mts +3 -1
  30. package/dist/compat/function/bind.d.ts +3 -1
  31. package/dist/compat/function/rest.d.mts +33 -0
  32. package/dist/compat/function/rest.d.ts +33 -0
  33. package/dist/compat/function/rest.mjs +11 -0
  34. package/dist/compat/index.d.mts +13 -0
  35. package/dist/compat/index.d.ts +13 -0
  36. package/dist/compat/index.js +413 -259
  37. package/dist/compat/index.mjs +13 -0
  38. package/dist/compat/object/get.mjs +2 -4
  39. package/dist/compat/object/has.d.mts +32 -0
  40. package/dist/compat/object/has.d.ts +32 -0
  41. package/dist/compat/object/has.mjs +34 -0
  42. package/dist/compat/object/merge.d.mts +1 -0
  43. package/dist/compat/object/merge.d.ts +1 -0
  44. package/dist/compat/object/mergeWith.d.mts +6 -0
  45. package/dist/compat/object/mergeWith.d.ts +6 -0
  46. package/dist/compat/object/mergeWith.mjs +0 -3
  47. package/dist/compat/object/set.mjs +1 -5
  48. package/dist/compat/predicate/isArrayLike.mjs +1 -2
  49. package/dist/compat/predicate/isString.d.mts +20 -0
  50. package/dist/compat/predicate/isString.d.ts +20 -0
  51. package/dist/compat/predicate/isString.mjs +13 -0
  52. package/dist/compat/predicate/matchesProperty.d.mts +28 -0
  53. package/dist/compat/predicate/matchesProperty.d.ts +28 -0
  54. package/dist/compat/predicate/matchesProperty.mjs +22 -0
  55. package/dist/compat/string/padEnd.d.mts +20 -0
  56. package/dist/compat/string/padEnd.d.ts +20 -0
  57. package/dist/compat/string/padEnd.mjs +5 -0
  58. package/dist/function/ary.d.mts +1 -1
  59. package/dist/function/ary.d.ts +1 -1
  60. package/dist/function/index.d.mts +4 -0
  61. package/dist/function/index.d.ts +4 -0
  62. package/dist/function/index.js +76 -0
  63. package/dist/function/index.mjs +4 -0
  64. package/dist/function/memoize.d.mts +87 -0
  65. package/dist/function/memoize.d.ts +87 -0
  66. package/dist/function/memoize.mjs +16 -0
  67. package/dist/function/partial.d.mts +33 -0
  68. package/dist/function/partial.d.ts +33 -0
  69. package/dist/function/partial.mjs +23 -0
  70. package/dist/function/partialRight.d.mts +33 -0
  71. package/dist/function/partialRight.d.ts +33 -0
  72. package/dist/function/partialRight.mjs +25 -0
  73. package/dist/function/rest.d.mts +33 -0
  74. package/dist/function/rest.d.ts +33 -0
  75. package/dist/function/rest.mjs +12 -0
  76. package/dist/function/unary.d.mts +1 -1
  77. package/dist/function/unary.d.ts +1 -1
  78. package/dist/index.d.mts +7 -0
  79. package/dist/index.d.ts +7 -0
  80. package/dist/index.js +21 -14
  81. package/dist/index.mjs +7 -0
  82. package/dist/object/index.d.mts +1 -0
  83. package/dist/object/index.d.ts +1 -0
  84. package/dist/object/index.js +14 -32
  85. package/dist/object/index.mjs +1 -0
  86. package/dist/object/toMerged.d.mts +45 -0
  87. package/dist/object/toMerged.d.ts +45 -0
  88. package/dist/object/toMerged.mjs +8 -0
  89. package/dist/predicate/index.d.mts +1 -0
  90. package/dist/predicate/index.d.ts +1 -0
  91. package/dist/predicate/index.js +6 -1
  92. package/dist/predicate/index.mjs +1 -0
  93. package/dist/predicate/isEqual.mjs +4 -5
  94. package/dist/predicate/isString.d.mts +20 -0
  95. package/dist/predicate/isString.d.ts +20 -0
  96. package/dist/predicate/isString.mjs +5 -0
  97. package/dist/string/camelCase.mjs +2 -2
  98. package/dist/string/index.js +2 -2
  99. package/package.json +1 -1
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const initial = require('../_chunk/initial-CBsbzo.js');
5
+ const initial = require('../_chunk/initial-y0QrPY.js');
6
6
  const promise_index = require('../_chunk/index-CwRt_M.js');
7
7
  const function_index = require('../function/index.js');
8
8
  const math_index = require('../math/index.js');
9
9
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
10
- const isObjectLike = require('../_chunk/isObjectLike-BeLCsr.js');
11
- const isFunction = require('../_chunk/isFunction-D0hq6d.js');
10
+ const toMerged = require('../_chunk/toMerged-BGwYW5.js');
11
+ const isFunction = require('../_chunk/isFunction-aCEz9d.js');
12
12
  const isTypedArray$1 = require('../_chunk/isTypedArray-BBEkFl.js');
13
13
  const string_index = require('../string/index.js');
14
14
 
@@ -42,6 +42,354 @@ function fill(array, value, start = 0, end = array.length) {
42
42
  return initial.fill(array, value, start, end);
43
43
  }
44
44
 
45
+ const IS_PLAIN = /^\w*$/;
46
+ const IS_DEEP = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
47
+ function isDeepKey(key) {
48
+ switch (typeof key) {
49
+ case 'number':
50
+ case 'symbol': {
51
+ return false;
52
+ }
53
+ case 'string': {
54
+ return !IS_PLAIN.test(key) && IS_DEEP.test(key);
55
+ }
56
+ }
57
+ }
58
+
59
+ function isSymbol(value) {
60
+ return typeof value === 'symbol' || (value != null && value instanceof Symbol);
61
+ }
62
+
63
+ function toKey(value) {
64
+ if (typeof value === 'string' || isSymbol(value)) {
65
+ return value;
66
+ }
67
+ if (Object.is(value?.valueOf(), -0)) {
68
+ return '-0';
69
+ }
70
+ return `${value}`;
71
+ }
72
+
73
+ function toPath(deepKey) {
74
+ const ESCAPE_REGEXP = /\\(\\)?/g;
75
+ const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
76
+ '|' +
77
+ '\\[(?:' +
78
+ '([^"\'][^[]*)' +
79
+ '|' +
80
+ '(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
81
+ ')\\]' +
82
+ '|' +
83
+ '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
84
+ const result = [];
85
+ if (deepKey[0] === '.') {
86
+ result.push('');
87
+ }
88
+ let match;
89
+ let lastIndex = 0;
90
+ while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {
91
+ let key = match[0];
92
+ const expr = match[1];
93
+ const quote = match[2];
94
+ const substr = match[3];
95
+ if (quote) {
96
+ key = substr.replace(ESCAPE_REGEXP, '$1');
97
+ }
98
+ else if (expr) {
99
+ key = expr;
100
+ }
101
+ result.push(key);
102
+ if (PROPERTY_REGEXP.lastIndex === lastIndex) {
103
+ PROPERTY_REGEXP.lastIndex++;
104
+ }
105
+ else {
106
+ lastIndex = PROPERTY_REGEXP.lastIndex;
107
+ }
108
+ }
109
+ return result;
110
+ }
111
+
112
+ function get(object, path, defaultValue) {
113
+ let resolvedPath;
114
+ if (Array.isArray(path)) {
115
+ resolvedPath = path;
116
+ }
117
+ else if (typeof path === 'string' && isDeepKey(path) && object?.[path] == null) {
118
+ resolvedPath = toPath(path);
119
+ }
120
+ else {
121
+ resolvedPath = [path];
122
+ }
123
+ if (resolvedPath.length === 0) {
124
+ return defaultValue;
125
+ }
126
+ let current = object;
127
+ let index;
128
+ for (index = 0; index < resolvedPath.length && current != null; index++) {
129
+ const key = toKey(resolvedPath[index]);
130
+ current = current[key];
131
+ }
132
+ if (current === null && index === resolvedPath.length) {
133
+ return current;
134
+ }
135
+ return current ?? defaultValue;
136
+ }
137
+
138
+ function property(path) {
139
+ return function (object) {
140
+ return get(object, path);
141
+ };
142
+ }
143
+
144
+ function isArrayMatch(target, source) {
145
+ if (source.length === 0) {
146
+ return true;
147
+ }
148
+ if (!Array.isArray(target)) {
149
+ return false;
150
+ }
151
+ const countedIndex = new Set();
152
+ for (let i = 0; i < source.length; i++) {
153
+ const sourceItem = source[i];
154
+ const index = target.findIndex((targetItem, index) => {
155
+ return isMatch(targetItem, sourceItem) && !countedIndex.has(index);
156
+ });
157
+ if (index === -1) {
158
+ return false;
159
+ }
160
+ countedIndex.add(index);
161
+ }
162
+ return true;
163
+ }
164
+
165
+ function isMapMatch(target, source) {
166
+ if (source.size === 0) {
167
+ return true;
168
+ }
169
+ if (!(target instanceof Map)) {
170
+ return false;
171
+ }
172
+ for (const [key, value] of source.entries()) {
173
+ if (!isMatch(target.get(key), value)) {
174
+ return false;
175
+ }
176
+ }
177
+ return true;
178
+ }
179
+
180
+ function isSetMatch(target, source) {
181
+ if (source.size === 0) {
182
+ return true;
183
+ }
184
+ if (!(target instanceof Set)) {
185
+ return false;
186
+ }
187
+ return isArrayMatch([...target], [...source]);
188
+ }
189
+
190
+ function isMatch(target, source) {
191
+ if (source === target) {
192
+ return true;
193
+ }
194
+ switch (typeof source) {
195
+ case 'object': {
196
+ if (source == null) {
197
+ return true;
198
+ }
199
+ const keys = Object.keys(source);
200
+ if (target == null) {
201
+ if (keys.length === 0) {
202
+ return true;
203
+ }
204
+ return false;
205
+ }
206
+ if (Array.isArray(source)) {
207
+ return isArrayMatch(target, source);
208
+ }
209
+ if (source instanceof Map) {
210
+ return isMapMatch(target, source);
211
+ }
212
+ if (source instanceof Set) {
213
+ return isSetMatch(target, source);
214
+ }
215
+ for (let i = 0; i < keys.length; i++) {
216
+ const key = keys[i];
217
+ if (!isTypedArray$1.isPrimitive(target) && !(key in target)) {
218
+ return false;
219
+ }
220
+ if (source[key] === undefined && target[key] !== undefined) {
221
+ return false;
222
+ }
223
+ if (!isMatch(target[key], source[key])) {
224
+ return false;
225
+ }
226
+ }
227
+ return true;
228
+ }
229
+ case 'function': {
230
+ if (Object.keys(source).length > 0) {
231
+ return isMatch(target, { ...source });
232
+ }
233
+ return false;
234
+ }
235
+ default: {
236
+ return !source;
237
+ }
238
+ }
239
+ }
240
+
241
+ function matches(source) {
242
+ source = toMerged.cloneDeep(source);
243
+ return (target) => {
244
+ return isMatch(target, source);
245
+ };
246
+ }
247
+
248
+ function cloneDeep(obj) {
249
+ if (typeof obj !== 'object') {
250
+ return toMerged.cloneDeep(obj);
251
+ }
252
+ switch (Object.prototype.toString.call(obj)) {
253
+ case isFunction.numberTag:
254
+ case isFunction.stringTag:
255
+ case isFunction.booleanTag: {
256
+ const result = new obj.constructor(obj?.valueOf());
257
+ toMerged.copyProperties(result, obj);
258
+ return result;
259
+ }
260
+ case isFunction.argumentsTag: {
261
+ const result = {};
262
+ toMerged.copyProperties(result, obj);
263
+ result.length = obj.length;
264
+ result[Symbol.iterator] = obj[Symbol.iterator];
265
+ return result;
266
+ }
267
+ default: {
268
+ return toMerged.cloneDeep(obj);
269
+ }
270
+ }
271
+ }
272
+
273
+ const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
274
+ function isIndex(value) {
275
+ switch (typeof value) {
276
+ case 'number': {
277
+ return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
278
+ }
279
+ case 'symbol': {
280
+ return false;
281
+ }
282
+ case 'string': {
283
+ return IS_UNSIGNED_INTEGER.test(value);
284
+ }
285
+ }
286
+ }
287
+
288
+ function isArguments(value) {
289
+ return value !== null && typeof value === 'object' && isFunction.getTag(value) === '[object Arguments]';
290
+ }
291
+
292
+ function has(object, path) {
293
+ let resolvedPath;
294
+ if (Array.isArray(path)) {
295
+ resolvedPath = path;
296
+ }
297
+ else if (typeof path === 'string' && isDeepKey(path) && object?.[path] == null) {
298
+ resolvedPath = toPath(path);
299
+ }
300
+ else {
301
+ resolvedPath = [path];
302
+ }
303
+ if (resolvedPath.length === 0) {
304
+ return false;
305
+ }
306
+ let current = object;
307
+ for (let i = 0; i < resolvedPath.length; i++) {
308
+ const key = resolvedPath[i];
309
+ if (current == null || !Object.prototype.hasOwnProperty.call(current, key)) {
310
+ const isSparseIndex = (Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length;
311
+ if (!isSparseIndex) {
312
+ return false;
313
+ }
314
+ }
315
+ current = current[key];
316
+ }
317
+ return true;
318
+ }
319
+
320
+ function matchesProperty(property, source) {
321
+ property = Array.isArray(property) ? property : toKey(property);
322
+ source = cloneDeep(source);
323
+ return function (target) {
324
+ const result = get(target, property);
325
+ if (result === undefined) {
326
+ return has(target, property);
327
+ }
328
+ if (source === undefined) {
329
+ return result === undefined;
330
+ }
331
+ return isMatch(result, source);
332
+ };
333
+ }
334
+
335
+ function find(source, doesMatch) {
336
+ let values = source;
337
+ if (!Array.isArray(source)) {
338
+ values = Object.values(source);
339
+ }
340
+ switch (typeof doesMatch) {
341
+ case 'function': {
342
+ if (!Array.isArray(source)) {
343
+ const entries = Object.entries(source);
344
+ for (let i = 0; i < entries.length; i++) {
345
+ const entry = entries[i];
346
+ const key = entry[0];
347
+ const value = entry[1];
348
+ if (doesMatch(value, key, source)) {
349
+ return value;
350
+ }
351
+ }
352
+ return undefined;
353
+ }
354
+ return values.find(doesMatch);
355
+ }
356
+ case 'object': {
357
+ if (Array.isArray(doesMatch) && doesMatch.length === 2) {
358
+ const key = doesMatch[0];
359
+ const value = doesMatch[1];
360
+ return values.find(matchesProperty(key, value));
361
+ }
362
+ else {
363
+ return values.find(matches(doesMatch));
364
+ }
365
+ }
366
+ case 'string': {
367
+ return values.find(property(doesMatch));
368
+ }
369
+ }
370
+ }
371
+
372
+ function findIndex(source, doesMatch) {
373
+ switch (typeof doesMatch) {
374
+ case 'function': {
375
+ return source.findIndex(doesMatch);
376
+ }
377
+ case 'object': {
378
+ if (Array.isArray(doesMatch) && doesMatch.length === 2) {
379
+ const key = doesMatch[0];
380
+ const value = doesMatch[1];
381
+ return source.findIndex(matchesProperty(key, value));
382
+ }
383
+ else {
384
+ return source.findIndex(matches(doesMatch));
385
+ }
386
+ }
387
+ case 'string': {
388
+ return source.findIndex(property(doesMatch));
389
+ }
390
+ }
391
+ }
392
+
45
393
  function flatten(value, depth = 1) {
46
394
  const result = [];
47
395
  const flooredDepth = Math.floor(depth);
@@ -78,10 +426,6 @@ function flattenDepth(value, depth = 1) {
78
426
  return flatten(value, depth);
79
427
  }
80
428
 
81
- function isSymbol(value) {
82
- return typeof value === 'symbol' || (value != null && value instanceof Symbol);
83
- }
84
-
85
429
  const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
86
430
  const regexIsPlainProp = /^\w*$/;
87
431
  function isKey(value, object) {
@@ -95,45 +439,6 @@ function isKey(value, object) {
95
439
  (object != null && Object.hasOwn(object, value)));
96
440
  }
97
441
 
98
- function toPath(deepKey) {
99
- const ESCAPE_REGEXP = /\\(\\)?/g;
100
- const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
101
- '|' +
102
- '\\[(?:' +
103
- '([^"\'][^[]*)' +
104
- '|' +
105
- '(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
106
- ')\\]' +
107
- '|' +
108
- '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
109
- const result = [];
110
- if (deepKey[0] === '.') {
111
- result.push('');
112
- }
113
- let match;
114
- let lastIndex = 0;
115
- while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {
116
- let key = match[0];
117
- const expr = match[1];
118
- const quote = match[2];
119
- const substr = match[3];
120
- if (quote) {
121
- key = substr.replace(ESCAPE_REGEXP, '$1');
122
- }
123
- else if (expr) {
124
- key = expr;
125
- }
126
- result.push(key);
127
- if (PROPERTY_REGEXP.lastIndex === lastIndex) {
128
- PROPERTY_REGEXP.lastIndex++;
129
- }
130
- else {
131
- lastIndex = PROPERTY_REGEXP.lastIndex;
132
- }
133
- }
134
- return result;
135
- }
136
-
137
442
  function getPath(key, object) {
138
443
  if (Array.isArray(key)) {
139
444
  const path = [];
@@ -213,27 +518,8 @@ function size(target) {
213
518
  return Object.keys(target).length;
214
519
  }
215
520
 
216
- const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
217
- function isIndex(value) {
218
- switch (typeof value) {
219
- case 'number': {
220
- return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
221
- }
222
- case 'symbol': {
223
- return false;
224
- }
225
- case 'string': {
226
- return IS_UNSIGNED_INTEGER.test(value);
227
- }
228
- }
229
- }
230
-
231
521
  function set(obj, path, value) {
232
- const resolvedPath = Array.isArray(path)
233
- ? path
234
- : typeof path === 'string'
235
- ? toPath(path)
236
- : [path];
522
+ const resolvedPath = Array.isArray(path) ? path : typeof path === 'string' ? toPath(path) : [path];
237
523
  let current = obj;
238
524
  for (let i = 0; i < resolvedPath.length - 1; i++) {
239
525
  const key = resolvedPath[i];
@@ -260,6 +546,25 @@ function zipObjectDeep(keys, values) {
260
546
  return result;
261
547
  }
262
548
 
549
+ function indexOf(array, searchElement, fromIndex) {
550
+ if (array == null) {
551
+ return -1;
552
+ }
553
+ if (Number.isNaN(searchElement)) {
554
+ fromIndex = fromIndex ?? 0;
555
+ if (fromIndex < 0) {
556
+ fromIndex = Math.max(0, array.length + fromIndex);
557
+ }
558
+ for (let i = fromIndex; i < array.length; i++) {
559
+ if (Number.isNaN(array[i])) {
560
+ return i;
561
+ }
562
+ }
563
+ return -1;
564
+ }
565
+ return array.indexOf(searchElement, fromIndex);
566
+ }
567
+
263
568
  function ary(func, n = func.length, guard) {
264
569
  if (guard) {
265
570
  n = func.length;
@@ -296,53 +601,12 @@ function bind(func, thisObj, ...partialArgs) {
296
601
  const bindPlaceholder = Symbol('bind.placeholder');
297
602
  bind.placeholder = bindPlaceholder;
298
603
 
299
- const IS_PLAIN = /^\w*$/;
300
- const IS_DEEP = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
301
- function isDeepKey(key) {
302
- switch (typeof key) {
303
- case 'number':
304
- case 'symbol': {
305
- return false;
306
- }
307
- case 'string': {
308
- return !IS_PLAIN.test(key) && IS_DEEP.test(key);
309
- }
310
- }
311
- }
312
-
313
- function get(object, path, defaultValue) {
314
- let resolvedPath;
315
- if (Array.isArray(path)) {
316
- resolvedPath = path;
317
- }
318
- else if (typeof path === 'string' && isDeepKey(path) && object?.[path] == null) {
319
- resolvedPath = toPath(path);
320
- }
321
- else {
322
- resolvedPath = [path];
323
- }
324
- if (resolvedPath.length === 0) {
325
- return defaultValue;
326
- }
327
- let current = object;
328
- let index;
329
- for (index = 0; index < resolvedPath.length && current != null; index++) {
330
- let key = resolvedPath[index];
331
- if (Object.is(key.valueOf(), -0)) {
332
- key = '-0';
333
- }
334
- current = current[key];
604
+ function rest(func, start = func.length - 1) {
605
+ start = Number.parseInt(start, 10);
606
+ if (Number.isNaN(start) || start < 0) {
607
+ start = func.length - 1;
335
608
  }
336
- if (current === null && index === resolvedPath.length) {
337
- return current;
338
- }
339
- return current ?? defaultValue;
340
- }
341
-
342
- function property(path) {
343
- return function (object) {
344
- return get(object, path);
345
- };
609
+ return function_index.rest(func, start);
346
610
  }
347
611
 
348
612
  function identity(x) {
@@ -356,10 +620,10 @@ function mapKeys(object, getNewKey) {
356
620
  case 'symbol':
357
621
  case 'number':
358
622
  case 'object': {
359
- return isObjectLike.mapKeys(object, property(getNewKey));
623
+ return toMerged.mapKeys(object, property(getNewKey));
360
624
  }
361
625
  case 'function': {
362
- return isObjectLike.mapKeys(object, getNewKey);
626
+ return toMerged.mapKeys(object, getNewKey);
363
627
  }
364
628
  }
365
629
  }
@@ -371,18 +635,14 @@ function mapValues(object, getNewValue) {
371
635
  case 'symbol':
372
636
  case 'number':
373
637
  case 'object': {
374
- return isObjectLike.mapValues(object, property(getNewValue));
638
+ return toMerged.mapValues(object, property(getNewValue));
375
639
  }
376
640
  case 'function': {
377
- return isObjectLike.mapValues(object, getNewValue);
641
+ return toMerged.mapValues(object, getNewValue);
378
642
  }
379
643
  }
380
644
  }
381
645
 
382
- function isArguments(value) {
383
- return value !== null && typeof value === 'object' && isFunction.getTag(value) === '[object Arguments]';
384
- }
385
-
386
646
  function isPlainObject(object) {
387
647
  if (typeof object !== 'object') {
388
648
  return false;
@@ -415,31 +675,6 @@ function isTypedArray(x) {
415
675
  return isTypedArray$1.isTypedArray(x);
416
676
  }
417
677
 
418
- function cloneDeep(obj) {
419
- if (typeof obj !== 'object') {
420
- return isObjectLike.cloneDeep(obj);
421
- }
422
- switch (Object.prototype.toString.call(obj)) {
423
- case isFunction.numberTag:
424
- case isFunction.stringTag:
425
- case isFunction.booleanTag: {
426
- const result = new obj.constructor(obj?.valueOf());
427
- isObjectLike.copyProperties(result, obj);
428
- return result;
429
- }
430
- case isFunction.argumentsTag: {
431
- const result = {};
432
- isObjectLike.copyProperties(result, obj);
433
- result.length = obj.length;
434
- result[Symbol.iterator] = obj[Symbol.iterator];
435
- return result;
436
- }
437
- default: {
438
- return isObjectLike.cloneDeep(obj);
439
- }
440
- }
441
- }
442
-
443
678
  function mergeWith(object, ...otherArgs) {
444
679
  const sources = otherArgs.slice(0, -1);
445
680
  const merge = otherArgs[otherArgs.length - 1];
@@ -455,7 +690,7 @@ function mergeWithDeep(target, source, merge, stack) {
455
690
  return target;
456
691
  }
457
692
  if (stack.has(source)) {
458
- return isObjectLike.clone(stack.get(source));
693
+ return toMerged.clone(stack.get(source));
459
694
  }
460
695
  stack.set(source, target);
461
696
  if (Array.isArray(source)) {
@@ -488,12 +723,9 @@ function mergeWithDeep(target, source, merge, stack) {
488
723
  else if (Array.isArray(sourceValue)) {
489
724
  target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);
490
725
  }
491
- else if (isObjectLike.isObjectLike(targetValue) && isObjectLike.isObjectLike(sourceValue)) {
726
+ else if (toMerged.isObjectLike(targetValue) && toMerged.isObjectLike(sourceValue)) {
492
727
  target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);
493
728
  }
494
- else if (targetValue == null && Array.isArray(sourceValue)) {
495
- target[key] = mergeWithDeep([], sourceValue, merge, stack);
496
- }
497
729
  else if (targetValue == null && isPlainObject(sourceValue)) {
498
730
  target[key] = mergeWithDeep({}, sourceValue, merge, stack);
499
731
  }
@@ -516,8 +748,7 @@ function isArray(value) {
516
748
  }
517
749
 
518
750
  function isArrayLike(value) {
519
- return value != null && typeof value !== "function" &&
520
- isFunction.isLength(value.length);
751
+ return value != null && typeof value !== 'function' && isFunction.isLength(value.length);
521
752
  }
522
753
 
523
754
  function isBoolean(x) {
@@ -530,108 +761,14 @@ function isBoolean(x) {
530
761
  return false;
531
762
  }
532
763
 
533
- function isArrayMatch(target, source) {
534
- if (source.length === 0) {
535
- return true;
536
- }
537
- if (!Array.isArray(target)) {
538
- return false;
539
- }
540
- const countedIndex = new Set();
541
- for (let i = 0; i < source.length; i++) {
542
- const sourceItem = source[i];
543
- const index = target.findIndex((targetItem, index) => {
544
- return isMatch(targetItem, sourceItem) && !countedIndex.has(index);
545
- });
546
- if (index === -1) {
547
- return false;
548
- }
549
- countedIndex.add(index);
550
- }
551
- return true;
552
- }
553
-
554
- function isMapMatch(target, source) {
555
- if (source.size === 0) {
556
- return true;
557
- }
558
- if (!(target instanceof Map)) {
559
- return false;
560
- }
561
- for (const [key, value] of source.entries()) {
562
- if (!isMatch(target.get(key), value)) {
563
- return false;
564
- }
565
- }
566
- return true;
567
- }
568
-
569
- function isSetMatch(target, source) {
570
- if (source.size === 0) {
764
+ function isString(value) {
765
+ if (typeof value === 'string') {
571
766
  return true;
572
767
  }
573
- if (!(target instanceof Set)) {
574
- return false;
575
- }
576
- return isArrayMatch([...target], [...source]);
577
- }
578
-
579
- function isMatch(target, source) {
580
- if (source === target) {
768
+ if (typeof value === 'object' && value != null && isFunction.getTag(value) === '[object String]') {
581
769
  return true;
582
770
  }
583
- switch (typeof source) {
584
- case 'object': {
585
- if (source == null) {
586
- return true;
587
- }
588
- const keys = Object.keys(source);
589
- if (target == null) {
590
- if (keys.length === 0) {
591
- return true;
592
- }
593
- return false;
594
- }
595
- if (Array.isArray(source)) {
596
- return isArrayMatch(target, source);
597
- }
598
- if (source instanceof Map) {
599
- return isMapMatch(target, source);
600
- }
601
- if (source instanceof Set) {
602
- return isSetMatch(target, source);
603
- }
604
- for (let i = 0; i < keys.length; i++) {
605
- const key = keys[i];
606
- if (!isTypedArray$1.isPrimitive(target) && !(key in target)) {
607
- return false;
608
- }
609
- if (source[key] === undefined && target[key] !== undefined) {
610
- return false;
611
- }
612
- if (!isMatch(target[key], source[key])) {
613
- return false;
614
- }
615
- }
616
- return true;
617
- }
618
- case 'function': {
619
- if (Object.keys(source).length > 0) {
620
- return isMatch(target, { ...source });
621
- }
622
- return false;
623
- }
624
- default: {
625
- return !source;
626
- }
627
- }
628
- }
629
-
630
- function matches(source) {
631
- source = isObjectLike.cloneDeep(source);
632
- return (target) => {
633
- return isMatch(target, source);
634
- };
771
+ return false;
635
772
  }
636
773
 
637
774
  const startsWith = (str, target, position = 0) => {
@@ -646,6 +783,10 @@ function padStart(str, length = 0, chars = ' ') {
646
783
  return str.padStart(length, chars);
647
784
  }
648
785
 
786
+ function padEnd(str, length = 0, chars = ' ') {
787
+ return str.padEnd(length, chars);
788
+ }
789
+
649
790
  function max(items = []) {
650
791
  let maxElement = items[0];
651
792
  let max = undefined;
@@ -696,6 +837,7 @@ exports.partition = initial.partition;
696
837
  exports.sample = initial.sample;
697
838
  exports.sampleSize = initial.sampleSize;
698
839
  exports.shuffle = initial.shuffle;
840
+ exports.sortBy = initial.sortBy;
699
841
  exports.tail = initial.tail;
700
842
  exports.take = initial.take;
701
843
  exports.takeRight = initial.takeRight;
@@ -724,9 +866,12 @@ exports.withTimeout = promise_index.withTimeout;
724
866
  exports.after = function_index.after;
725
867
  exports.before = function_index.before;
726
868
  exports.debounce = function_index.debounce;
869
+ exports.memoize = function_index.memoize;
727
870
  exports.negate = function_index.negate;
728
871
  exports.noop = function_index.noop;
729
872
  exports.once = function_index.once;
873
+ exports.partial = function_index.partial;
874
+ exports.partialRight = function_index.partialRight;
730
875
  exports.throttle = function_index.throttle;
731
876
  exports.unary = function_index.unary;
732
877
  exports.clamp = math_index.clamp;
@@ -739,15 +884,16 @@ exports.sum = math_index.sum;
739
884
  exports.sumBy = math_index.sumBy;
740
885
  exports.random = randomInt.random;
741
886
  exports.randomInt = randomInt.randomInt;
742
- exports.clone = isObjectLike.clone;
743
- exports.cloneDeep = isObjectLike.cloneDeep;
744
- exports.flattenObject = isObjectLike.flattenObject;
745
- exports.invert = isObjectLike.invert;
746
- exports.isObjectLike = isObjectLike.isObjectLike;
747
- exports.omit = isObjectLike.omit;
748
- exports.omitBy = isObjectLike.omitBy;
749
- exports.pick = isObjectLike.pick;
750
- exports.pickBy = isObjectLike.pickBy;
887
+ exports.clone = toMerged.clone;
888
+ exports.cloneDeep = toMerged.cloneDeep;
889
+ exports.flattenObject = toMerged.flattenObject;
890
+ exports.invert = toMerged.invert;
891
+ exports.isObjectLike = toMerged.isObjectLike;
892
+ exports.omit = toMerged.omit;
893
+ exports.omitBy = toMerged.omitBy;
894
+ exports.pick = toMerged.pick;
895
+ exports.pickBy = toMerged.pickBy;
896
+ exports.toMerged = toMerged.toMerged;
751
897
  exports.isEqual = isFunction.isEqual;
752
898
  exports.isFunction = isFunction.isFunction;
753
899
  exports.isLength = isFunction.isLength;
@@ -770,28 +916,36 @@ exports.concat = concat;
770
916
  exports.difference = difference;
771
917
  exports.endsWith = endsWith;
772
918
  exports.fill = fill;
919
+ exports.find = find;
920
+ exports.findIndex = findIndex;
773
921
  exports.flatten = flatten;
774
922
  exports.flattenDeep = flattenDeep;
775
923
  exports.flattenDepth = flattenDepth;
776
924
  exports.get = get;
925
+ exports.has = has;
926
+ exports.indexOf = indexOf;
777
927
  exports.isArguments = isArguments;
778
928
  exports.isArray = isArray;
779
929
  exports.isArrayLike = isArrayLike;
780
930
  exports.isBoolean = isBoolean;
781
931
  exports.isMatch = isMatch;
782
932
  exports.isPlainObject = isPlainObject;
933
+ exports.isString = isString;
783
934
  exports.isSymbol = isSymbol;
784
935
  exports.isTypedArray = isTypedArray;
785
936
  exports.mapKeys = mapKeys;
786
937
  exports.mapValues = mapValues;
787
938
  exports.matches = matches;
939
+ exports.matchesProperty = matchesProperty;
788
940
  exports.max = max;
789
941
  exports.merge = merge;
790
942
  exports.mergeWith = mergeWith;
791
943
  exports.min = min;
792
944
  exports.orderBy = orderBy;
945
+ exports.padEnd = padEnd;
793
946
  exports.padStart = padStart;
794
947
  exports.property = property;
948
+ exports.rest = rest;
795
949
  exports.set = set;
796
950
  exports.size = size;
797
951
  exports.startsWith = startsWith;