es-toolkit 1.26.1 → 1.27.0-dev.876

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 (109) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/_chunk/{sumBy-RVppiV.js → rangeRight-w3WrXN.js} +2 -14
  3. package/dist/_chunk/{toMerged-wNz52b.js → toMerged-CPY8Ug.js} +7 -1
  4. package/dist/_chunk/{upperFirst-BUECmK.js → upperFirst-DK_rTF.js} +23 -23
  5. package/dist/_chunk/{zipWith-Dkv3D1.js → zipWith-Bb2eZI.js} +19 -5
  6. package/dist/array/at.mjs +7 -2
  7. package/dist/array/index.d.mts +1 -0
  8. package/dist/array/index.d.ts +1 -0
  9. package/dist/array/index.js +2 -1
  10. package/dist/array/index.mjs +1 -0
  11. package/dist/array/isSubsetWith.d.mts +33 -0
  12. package/dist/array/isSubsetWith.d.ts +33 -0
  13. package/dist/array/isSubsetWith.mjs +7 -0
  14. package/dist/array/without.mjs +3 -2
  15. package/dist/array/zip.mjs +6 -1
  16. package/dist/browser.global.js +1 -1
  17. package/dist/browser.global.js.map +1 -1
  18. package/dist/compat/_internal/flattenArrayLike.mjs +17 -0
  19. package/dist/compat/_internal/isPrototype.mjs +7 -0
  20. package/dist/compat/_internal/toArray.mjs +5 -0
  21. package/dist/compat/array/chunk.mjs +2 -1
  22. package/dist/compat/array/difference.mjs +2 -1
  23. package/dist/compat/array/differenceBy.d.mts +82 -0
  24. package/dist/compat/array/differenceBy.d.ts +82 -0
  25. package/dist/compat/array/differenceBy.mjs +20 -0
  26. package/dist/compat/array/drop.mjs +2 -1
  27. package/dist/compat/array/dropRight.mjs +2 -1
  28. package/dist/compat/array/dropWhile.mjs +2 -1
  29. package/dist/compat/array/findLastIndex.mjs +2 -1
  30. package/dist/compat/array/forEach.d.mts +106 -0
  31. package/dist/compat/array/forEach.d.ts +106 -0
  32. package/dist/compat/array/forEach.mjs +21 -0
  33. package/dist/compat/array/head.mjs +2 -1
  34. package/dist/compat/array/last.mjs +2 -1
  35. package/dist/compat/array/sample.mjs +2 -1
  36. package/dist/compat/array/tail.mjs +2 -1
  37. package/dist/compat/array/take.mjs +2 -1
  38. package/dist/compat/array/takeRight.mjs +2 -1
  39. package/dist/compat/array/union.d.mts +30 -0
  40. package/dist/compat/array/union.d.ts +30 -0
  41. package/dist/compat/array/union.mjs +11 -0
  42. package/dist/compat/array/uniqBy.d.mts +60 -0
  43. package/dist/compat/array/uniqBy.d.ts +60 -0
  44. package/dist/compat/array/uniqBy.mjs +25 -0
  45. package/dist/compat/array/unzip.d.mts +16 -0
  46. package/dist/compat/array/unzip.d.ts +16 -0
  47. package/dist/compat/array/unzip.mjs +14 -0
  48. package/dist/compat/array/zip.d.mts +134 -0
  49. package/dist/compat/array/zip.d.ts +134 -0
  50. package/dist/compat/array/zip.mjs +11 -0
  51. package/dist/compat/index.d.mts +15 -8
  52. package/dist/compat/index.d.ts +15 -8
  53. package/dist/compat/index.js +312 -104
  54. package/dist/compat/index.mjs +15 -8
  55. package/dist/compat/math/sum.d.mts +37 -0
  56. package/dist/compat/math/sum.d.ts +37 -0
  57. package/dist/compat/math/sum.mjs +7 -0
  58. package/dist/compat/math/sumBy.d.mts +64 -0
  59. package/dist/compat/math/sumBy.d.ts +64 -0
  60. package/dist/compat/math/sumBy.mjs +20 -0
  61. package/dist/compat/predicate/isEmpty.d.mts +78 -0
  62. package/dist/compat/predicate/isEmpty.d.ts +78 -0
  63. package/dist/compat/predicate/isEmpty.mjs +33 -0
  64. package/dist/compat/string/replace.d.mts +17 -0
  65. package/dist/compat/string/replace.d.ts +17 -0
  66. package/dist/compat/string/replace.mjs +10 -0
  67. package/dist/compat/string/startCase.mjs +4 -4
  68. package/dist/compat/util/iteratee.d.mts +44 -0
  69. package/dist/compat/util/iteratee.d.ts +44 -0
  70. package/dist/compat/util/iteratee.mjs +28 -0
  71. package/dist/compat/util/toPath.mjs +56 -25
  72. package/dist/index.d.mts +3 -0
  73. package/dist/index.d.ts +3 -0
  74. package/dist/index.js +17 -14
  75. package/dist/index.mjs +3 -0
  76. package/dist/math/index.js +19 -11
  77. package/dist/math/range.mjs +1 -4
  78. package/dist/math/rangeRight.mjs +1 -4
  79. package/dist/math/sumBy.mjs +5 -4
  80. package/dist/object/cloneDeep.mjs +1 -1
  81. package/dist/object/findKey.d.mts +21 -0
  82. package/dist/object/findKey.d.ts +21 -0
  83. package/dist/object/findKey.mjs +6 -0
  84. package/dist/object/index.d.mts +1 -0
  85. package/dist/object/index.d.ts +1 -0
  86. package/dist/object/index.js +2 -1
  87. package/dist/object/index.mjs +1 -0
  88. package/dist/object/mapKeys.d.mts +4 -5
  89. package/dist/object/mapKeys.d.ts +4 -5
  90. package/dist/object/mergeWith.d.mts +1 -1
  91. package/dist/object/mergeWith.d.ts +1 -1
  92. package/dist/object/toMerged.d.mts +1 -1
  93. package/dist/object/toMerged.d.ts +1 -1
  94. package/dist/string/camelCase.mjs +4 -4
  95. package/dist/string/constantCase.mjs +3 -3
  96. package/dist/string/index.d.mts +1 -0
  97. package/dist/string/index.d.ts +1 -0
  98. package/dist/string/index.js +3 -2
  99. package/dist/string/index.mjs +1 -0
  100. package/dist/string/kebabCase.mjs +3 -3
  101. package/dist/string/lowerCase.mjs +3 -3
  102. package/dist/string/pascalCase.mjs +3 -3
  103. package/dist/string/snakeCase.mjs +3 -3
  104. package/dist/string/startCase.mjs +4 -4
  105. package/dist/string/upperCase.mjs +5 -5
  106. package/dist/string/words.d.mts +20 -0
  107. package/dist/string/words.d.ts +20 -0
  108. package/dist/string/{_internal/getWords.mjs → words.mjs} +2 -2
  109. package/package.json +1 -1
@@ -2,16 +2,16 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const zipWith = require('../_chunk/zipWith-Dkv3D1.js');
5
+ const zipWith = require('../_chunk/zipWith-Bb2eZI.js');
6
6
  const promise_index = require('../_chunk/index-BGZDR9.js');
7
7
  const unary = require('../_chunk/unary-CcTNuC.js');
8
8
  const noop = require('../_chunk/noop-2IwLUk.js');
9
- const sumBy = require('../_chunk/sumBy-RVppiV.js');
9
+ const rangeRight = require('../_chunk/rangeRight-w3WrXN.js');
10
10
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
11
- const toMerged = require('../_chunk/toMerged-wNz52b.js');
11
+ const toMerged = require('../_chunk/toMerged-CPY8Ug.js');
12
12
  const isPlainObject$1 = require('../_chunk/isPlainObject-octpoD.js');
13
13
  const isWeakSet$1 = require('../_chunk/isWeakSet-D8h8bS.js');
14
- const upperFirst = require('../_chunk/upperFirst-BUECmK.js');
14
+ const upperFirst = require('../_chunk/upperFirst-DK_rTF.js');
15
15
  const util_index = require('../util/index.js');
16
16
 
17
17
  function castArray(value) {
@@ -21,6 +21,10 @@ function castArray(value) {
21
21
  return Array.isArray(value) ? value : [value];
22
22
  }
23
23
 
24
+ function toArray(value) {
25
+ return Array.isArray(value) ? value : Array.from(value);
26
+ }
27
+
24
28
  function isArrayLike(value) {
25
29
  return value != null && typeof value !== 'function' && isWeakSet$1.isLength(value.length);
26
30
  }
@@ -30,7 +34,7 @@ function chunk(arr, size = 1) {
30
34
  if (size === 0 || !isArrayLike(arr)) {
31
35
  return [];
32
36
  }
33
- return zipWith.chunk(Array.from(arr), size);
37
+ return zipWith.chunk(toArray(arr), size);
34
38
  }
35
39
 
36
40
  function compact(arr) {
@@ -52,7 +56,7 @@ function difference(arr, ...values) {
52
56
  if (!isArrayLikeObject(arr)) {
53
57
  return [];
54
58
  }
55
- const arr1 = Array.from(arr);
59
+ const arr1 = toArray(arr);
56
60
  const arr2 = [];
57
61
  for (let i = 0; i < values.length; i++) {
58
62
  const value = values[i];
@@ -63,49 +67,25 @@ function difference(arr, ...values) {
63
67
  return zipWith.difference(arr1, arr2);
64
68
  }
65
69
 
66
- function isSymbol(value) {
67
- return typeof value === 'symbol' || value instanceof Symbol;
68
- }
69
-
70
- function toNumber(value) {
71
- if (isSymbol(value)) {
72
- return NaN;
73
- }
74
- return Number(value);
75
- }
76
-
77
- function toFinite(value) {
78
- if (!value) {
79
- return value === 0 ? value : 0;
80
- }
81
- value = toNumber(value);
82
- if (value === Infinity || value === -Infinity) {
83
- const sign = value < 0 ? -1 : 1;
84
- return sign * Number.MAX_VALUE;
85
- }
86
- return value === value ? value : 0;
87
- }
88
-
89
- function toInteger(value) {
90
- const finite = toFinite(value);
91
- const remainder = finite % 1;
92
- return remainder ? finite - remainder : finite;
93
- }
94
-
95
- function drop(collection, itemsCount = 1, guard) {
96
- if (!isArrayLike(collection)) {
97
- return [];
70
+ function last(array) {
71
+ if (!isArrayLike(array)) {
72
+ return undefined;
98
73
  }
99
- itemsCount = guard ? 1 : toInteger(itemsCount);
100
- return zipWith.drop(Array.from(collection), itemsCount);
74
+ return zipWith.last(toArray(array));
101
75
  }
102
76
 
103
- function dropRight(collection, itemsCount = 1, guard) {
104
- if (!isArrayLike(collection)) {
105
- return [];
77
+ function flattenArrayLike(values) {
78
+ const result = [];
79
+ for (let i = 0; i < values.length; i++) {
80
+ const arrayLike = values[i];
81
+ if (!isArrayLikeObject(arrayLike)) {
82
+ continue;
83
+ }
84
+ for (let j = 0; j < arrayLike.length; j++) {
85
+ result.push(arrayLike[j]);
86
+ }
106
87
  }
107
- itemsCount = guard ? 1 : toInteger(itemsCount);
108
- return zipWith.dropRight(Array.from(collection), itemsCount);
88
+ return result;
109
89
  }
110
90
 
111
91
  function isDeepKey(key) {
@@ -127,37 +107,68 @@ function toKey(value) {
127
107
  return value.toString();
128
108
  }
129
109
 
130
- const DOTS_KEY = /^[\w.]+$/g;
131
- const ESCAPE_REGEXP = /\\(\\)?/g;
132
- const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
133
- '|' +
134
- '\\[(?:' +
135
- '([^"\'][^[]*)' +
136
- '|' +
137
- '(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
138
- ')\\]' +
139
- '|' +
140
- '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
141
110
  function toPath(deepKey) {
142
- if (DOTS_KEY.test(deepKey)) {
143
- return deepKey.split('.');
144
- }
145
111
  const result = [];
146
- if (deepKey[0] === '.') {
112
+ const length = deepKey.length;
113
+ if (length === 0) {
114
+ return result;
115
+ }
116
+ let index = 0;
117
+ let key = '';
118
+ let quoteChar = '';
119
+ let bracket = false;
120
+ if (deepKey.charCodeAt(0) === 46) {
147
121
  result.push('');
122
+ index++;
148
123
  }
149
- const matches = deepKey.matchAll(PROPERTY_REGEXP);
150
- for (const match of matches) {
151
- let key = match[0];
152
- const expr = match[1];
153
- const quote = match[2];
154
- const substr = match[3];
155
- if (quote) {
156
- key = substr.replace(ESCAPE_REGEXP, '$1');
124
+ while (index < length) {
125
+ const char = deepKey[index];
126
+ if (quoteChar) {
127
+ if (char === '\\' && index + 1 < length) {
128
+ index++;
129
+ key += deepKey[index];
130
+ }
131
+ else if (char === quoteChar) {
132
+ quoteChar = '';
133
+ }
134
+ else {
135
+ key += char;
136
+ }
157
137
  }
158
- else if (expr) {
159
- key = expr;
138
+ else if (bracket) {
139
+ if (char === '"' || char === "'") {
140
+ quoteChar = char;
141
+ }
142
+ else if (char === ']') {
143
+ bracket = false;
144
+ result.push(key);
145
+ key = '';
146
+ }
147
+ else {
148
+ key += char;
149
+ }
160
150
  }
151
+ else {
152
+ if (char === '[') {
153
+ bracket = true;
154
+ if (key) {
155
+ result.push(key);
156
+ key = '';
157
+ }
158
+ }
159
+ else if (char === '.') {
160
+ if (key) {
161
+ result.push(key);
162
+ key = '';
163
+ }
164
+ }
165
+ else {
166
+ key += char;
167
+ }
168
+ }
169
+ index++;
170
+ }
171
+ if (key) {
161
172
  result.push(key);
162
173
  }
163
174
  return result;
@@ -441,6 +452,85 @@ function matchesProperty(property, source) {
441
452
  };
442
453
  }
443
454
 
455
+ function iteratee(value) {
456
+ if (value == null) {
457
+ return unary.identity;
458
+ }
459
+ switch (typeof value) {
460
+ case 'function': {
461
+ return value;
462
+ }
463
+ case 'object': {
464
+ if (Array.isArray(value) && value.length === 2) {
465
+ return matchesProperty(value[0], value[1]);
466
+ }
467
+ return matches(value);
468
+ }
469
+ case 'string':
470
+ case 'symbol':
471
+ case 'number': {
472
+ return property(value);
473
+ }
474
+ }
475
+ }
476
+
477
+ function differenceBy(arr, ..._values) {
478
+ if (!isArrayLikeObject(arr)) {
479
+ return [];
480
+ }
481
+ const iteratee$1 = last(_values);
482
+ const values = flattenArrayLike(_values);
483
+ if (isArrayLikeObject(iteratee$1)) {
484
+ return zipWith.difference(Array.from(arr), values);
485
+ }
486
+ return zipWith.differenceBy(Array.from(arr), values, iteratee(iteratee$1));
487
+ }
488
+
489
+ function isSymbol(value) {
490
+ return typeof value === 'symbol' || value instanceof Symbol;
491
+ }
492
+
493
+ function toNumber(value) {
494
+ if (isSymbol(value)) {
495
+ return NaN;
496
+ }
497
+ return Number(value);
498
+ }
499
+
500
+ function toFinite(value) {
501
+ if (!value) {
502
+ return value === 0 ? value : 0;
503
+ }
504
+ value = toNumber(value);
505
+ if (value === Infinity || value === -Infinity) {
506
+ const sign = value < 0 ? -1 : 1;
507
+ return sign * Number.MAX_VALUE;
508
+ }
509
+ return value === value ? value : 0;
510
+ }
511
+
512
+ function toInteger(value) {
513
+ const finite = toFinite(value);
514
+ const remainder = finite % 1;
515
+ return remainder ? finite - remainder : finite;
516
+ }
517
+
518
+ function drop(collection, itemsCount = 1, guard) {
519
+ if (!isArrayLike(collection)) {
520
+ return [];
521
+ }
522
+ itemsCount = guard ? 1 : toInteger(itemsCount);
523
+ return zipWith.drop(toArray(collection), itemsCount);
524
+ }
525
+
526
+ function dropRight(collection, itemsCount = 1, guard) {
527
+ if (!isArrayLike(collection)) {
528
+ return [];
529
+ }
530
+ itemsCount = guard ? 1 : toInteger(itemsCount);
531
+ return zipWith.dropRight(toArray(collection), itemsCount);
532
+ }
533
+
444
534
  function dropRightWhile(arr, predicate) {
445
535
  if (!isArrayLike(arr)) {
446
536
  return [];
@@ -472,7 +562,7 @@ function dropWhile(arr, predicate) {
472
562
  if (!isArrayLike(arr)) {
473
563
  return [];
474
564
  }
475
- return dropWhileImpl(Array.from(arr), predicate);
565
+ return dropWhileImpl(toArray(arr), predicate);
476
566
  }
477
567
  function dropWhileImpl(arr, predicate) {
478
568
  switch (typeof predicate) {
@@ -687,7 +777,7 @@ function findLastIndex(arr, doesMatch, fromIndex = arr ? arr.length - 1 : 0) {
687
777
  else {
688
778
  fromIndex = Math.min(fromIndex, arr.length - 1);
689
779
  }
690
- const subArray = Array.from(arr).slice(0, fromIndex + 1);
780
+ const subArray = toArray(arr).slice(0, fromIndex + 1);
691
781
  switch (typeof doesMatch) {
692
782
  case 'function': {
693
783
  return subArray.findLastIndex(doesMatch);
@@ -745,11 +835,27 @@ function flattenDepth(value, depth = 1) {
745
835
  return flatten(value, depth);
746
836
  }
747
837
 
838
+ function forEach(collection, callback = unary.identity) {
839
+ if (!collection) {
840
+ return collection;
841
+ }
842
+ const keys = isArrayLike(collection) || Array.isArray(collection) ? rangeRight.range(0, collection.length) : Object.keys(collection);
843
+ for (let i = 0; i < keys.length; i++) {
844
+ const key = keys[i];
845
+ const value = collection[key];
846
+ const result = callback(value, key, collection);
847
+ if (result === false) {
848
+ break;
849
+ }
850
+ }
851
+ return collection;
852
+ }
853
+
748
854
  function head(arr) {
749
855
  if (!isArrayLike(arr)) {
750
856
  return undefined;
751
857
  }
752
- return zipWith.head(Array.from(arr));
858
+ return zipWith.head(toArray(arr));
753
859
  }
754
860
 
755
861
  function includes(source, target, fromIndex, guard) {
@@ -859,13 +965,6 @@ function join(array, separator = ',') {
859
965
  return Array.from(array).join(separator);
860
966
  }
861
967
 
862
- function last(array) {
863
- if (!isArrayLike(array)) {
864
- return undefined;
865
- }
866
- return zipWith.last(Array.from(array));
867
- }
868
-
869
968
  function getPriority(a) {
870
969
  if (typeof a === 'symbol') {
871
970
  return 1;
@@ -992,7 +1091,7 @@ function sample(collection) {
992
1091
  return undefined;
993
1092
  }
994
1093
  if (isArrayLike(collection)) {
995
- return zipWith.sample(Array.from(collection));
1094
+ return zipWith.sample(toArray(collection));
996
1095
  }
997
1096
  return zipWith.sample(Object.values(collection));
998
1097
  }
@@ -1098,7 +1197,7 @@ function tail(arr) {
1098
1197
  if (!isArrayLike(arr)) {
1099
1198
  return [];
1100
1199
  }
1101
- return zipWith.tail(Array.from(arr));
1200
+ return zipWith.tail(toArray(arr));
1102
1201
  }
1103
1202
 
1104
1203
  function take(arr, count = 1, guard) {
@@ -1106,7 +1205,7 @@ function take(arr, count = 1, guard) {
1106
1205
  if (count < 1 || !isArrayLike(arr)) {
1107
1206
  return [];
1108
1207
  }
1109
- return zipWith.take(Array.from(arr), count);
1208
+ return zipWith.take(toArray(arr), count);
1110
1209
  }
1111
1210
 
1112
1211
  function takeRight(arr, count = 1, guard) {
@@ -1114,7 +1213,13 @@ function takeRight(arr, count = 1, guard) {
1114
1213
  if (count <= 0 || !isArrayLike(arr)) {
1115
1214
  return [];
1116
1215
  }
1117
- return zipWith.takeRight(Array.from(arr), count);
1216
+ return zipWith.takeRight(toArray(arr), count);
1217
+ }
1218
+
1219
+ function union(...arrays) {
1220
+ const validArrays = arrays.filter(isArrayLikeObject);
1221
+ const flattened = flatten(validArrays, 1);
1222
+ return zipWith.uniq(flattened);
1118
1223
  }
1119
1224
 
1120
1225
  function uniq(arr) {
@@ -1124,6 +1229,33 @@ function uniq(arr) {
1124
1229
  return zipWith.uniq(Array.from(arr));
1125
1230
  }
1126
1231
 
1232
+ function uniqBy(arr, ...values) {
1233
+ if (!isArrayLikeObject(arr)) {
1234
+ return [];
1235
+ }
1236
+ const iteratee$1 = last(values);
1237
+ if (iteratee$1 === undefined) {
1238
+ return Array.from(arr);
1239
+ }
1240
+ const validArrays = values.slice(0, -1).filter(isArrayLikeObject);
1241
+ const flattenedArrays = flatten(validArrays);
1242
+ const allValues = [...Array.from(arr), ...flattenedArrays];
1243
+ if (isArrayLikeObject(iteratee$1)) {
1244
+ return zipWith.uniq(allValues);
1245
+ }
1246
+ return zipWith.uniqBy(allValues, iteratee(iteratee$1));
1247
+ }
1248
+
1249
+ function unzip(array) {
1250
+ if (!isArrayLikeObject(array) || !array.length) {
1251
+ return [];
1252
+ }
1253
+ if (Array.isArray(array)) {
1254
+ return zipWith.unzip(array);
1255
+ }
1256
+ return zipWith.unzip(Array.from(array, value => Array.from(value)));
1257
+ }
1258
+
1127
1259
  function without(array, ...values) {
1128
1260
  if (!isArrayLikeObject(array)) {
1129
1261
  return [];
@@ -1131,6 +1263,13 @@ function without(array, ...values) {
1131
1263
  return zipWith.without(Array.from(array), ...values);
1132
1264
  }
1133
1265
 
1266
+ function zip(...arrays) {
1267
+ if (!arrays.length) {
1268
+ return [];
1269
+ }
1270
+ return zipWith.zip(...arrays.filter(group => isArrayLikeObject(group)));
1271
+ }
1272
+
1134
1273
  function set(obj, path, value) {
1135
1274
  const resolvedPath = Array.isArray(path) ? path : typeof path === 'string' ? toPath(path) : [path];
1136
1275
  let current = obj;
@@ -1517,7 +1656,7 @@ function clamp(value, bound1, bound2) {
1517
1656
  if (Number.isNaN(bound2)) {
1518
1657
  bound2 = 0;
1519
1658
  }
1520
- return sumBy.clamp(value, bound1, bound2);
1659
+ return rangeRight.clamp(value, bound1, bound2);
1521
1660
  }
1522
1661
 
1523
1662
  function floor(number, precision = 0) {
@@ -1546,7 +1685,7 @@ function inRange(value, minimum, maximum) {
1546
1685
  if (minimum === maximum) {
1547
1686
  return false;
1548
1687
  }
1549
- return sumBy.inRange(value, minimum, maximum);
1688
+ return rangeRight.inRange(value, minimum, maximum);
1550
1689
  }
1551
1690
 
1552
1691
  function max(items = []) {
@@ -1651,6 +1790,27 @@ function round(number, precision = 0) {
1651
1790
  return decimalAdjust('round', number, precision);
1652
1791
  }
1653
1792
 
1793
+ function sumBy(array, iteratee$1) {
1794
+ if (!array || !array.length) {
1795
+ return 0;
1796
+ }
1797
+ if (iteratee$1 != null) {
1798
+ iteratee$1 = iteratee(iteratee$1);
1799
+ }
1800
+ let result = iteratee$1 ? iteratee$1(array[0]) : array[0];
1801
+ for (let i = 1; i < array.length; i++) {
1802
+ const current = iteratee$1 ? iteratee$1(array[i]) : array[i];
1803
+ if (current !== undefined) {
1804
+ result += current;
1805
+ }
1806
+ }
1807
+ return result;
1808
+ }
1809
+
1810
+ function sum(array) {
1811
+ return sumBy(array);
1812
+ }
1813
+
1654
1814
  function defaults(object, ...sources) {
1655
1815
  object = Object(object);
1656
1816
  const objectProto = Object.prototype;
@@ -2019,6 +2179,39 @@ function isDate(value) {
2019
2179
  return isWeakSet$1.isDate(value);
2020
2180
  }
2021
2181
 
2182
+ function isPrototype(value) {
2183
+ const constructor = value.constructor;
2184
+ const prototype = typeof constructor === 'function' ? constructor.prototype : Object.prototype;
2185
+ return value === prototype;
2186
+ }
2187
+
2188
+ function isEmpty(value) {
2189
+ if (value == null) {
2190
+ return true;
2191
+ }
2192
+ if (isArrayLike(value)) {
2193
+ if (typeof value.splice !== 'function' &&
2194
+ typeof value !== 'string' &&
2195
+ (typeof Buffer === 'undefined' || !Buffer.isBuffer(value)) &&
2196
+ !isTypedArray(value) &&
2197
+ !isArguments(value)) {
2198
+ return false;
2199
+ }
2200
+ return value.length === 0;
2201
+ }
2202
+ if (typeof value === 'object') {
2203
+ if (value instanceof Map || value instanceof Set) {
2204
+ return value.size === 0;
2205
+ }
2206
+ const keys = Object.keys(value);
2207
+ if (isPrototype(value)) {
2208
+ return keys.filter(x => x !== 'constructor').length === 0;
2209
+ }
2210
+ return keys.length === 0;
2211
+ }
2212
+ return true;
2213
+ }
2214
+
2022
2215
  function isEqualWith(a, b, areValuesEqual = noop.noop) {
2023
2216
  if (typeof areValuesEqual !== 'function') {
2024
2217
  areValuesEqual = noop.noop;
@@ -2138,12 +2331,19 @@ function repeat(str, n) {
2138
2331
  return str.repeat(n);
2139
2332
  }
2140
2333
 
2334
+ function replace(target = '', pattern, replacement) {
2335
+ if (arguments.length < 3) {
2336
+ return toString(target);
2337
+ }
2338
+ return toString(target).replace(pattern, replacement);
2339
+ }
2340
+
2141
2341
  function snakeCase(str) {
2142
2342
  return upperFirst.snakeCase(normalizeForCase(str));
2143
2343
  }
2144
2344
 
2145
2345
  function startCase(str) {
2146
- const words = upperFirst.getWords(normalizeForCase(str).trim());
2346
+ const words = upperFirst.words(normalizeForCase(str).trim());
2147
2347
  let result = '';
2148
2348
  for (let i = 0; i < words.length; i++) {
2149
2349
  const word = words[i];
@@ -2164,10 +2364,6 @@ function startsWith(str, target, position = 0) {
2164
2364
  return str.startsWith(target, position);
2165
2365
  }
2166
2366
 
2167
- function upperCase(str) {
2168
- return upperFirst.upperCase(normalizeForCase(str));
2169
- }
2170
-
2171
2367
  const esTemplateRegExp = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
2172
2368
  const unEscapedRegExp = /['\n\r\u2028\u2029\\]/g;
2173
2369
  const noMatchExp = /($^)/;
@@ -2314,6 +2510,10 @@ function trimStart(str, chars, guard) {
2314
2510
  }
2315
2511
  }
2316
2512
 
2513
+ function upperCase(str) {
2514
+ return upperFirst.upperCase(normalizeForCase(str));
2515
+ }
2516
+
2317
2517
  function constant(value) {
2318
2518
  return () => value;
2319
2519
  }
@@ -2364,7 +2564,6 @@ function uniqueId(prefix = '') {
2364
2564
 
2365
2565
  exports.at = zipWith.at;
2366
2566
  exports.countBy = zipWith.countBy;
2367
- exports.differenceBy = zipWith.differenceBy;
2368
2567
  exports.differenceWith = zipWith.differenceWith;
2369
2568
  exports.flatMap = zipWith.flatMap;
2370
2569
  exports.flatMapDeep = zipWith.flatMapDeep;
@@ -2373,6 +2572,7 @@ exports.groupBy = zipWith.groupBy;
2373
2572
  exports.initial = zipWith.initial;
2374
2573
  exports.intersectionWith = zipWith.intersectionWith;
2375
2574
  exports.isSubset = zipWith.isSubset;
2575
+ exports.isSubsetWith = zipWith.isSubsetWith;
2376
2576
  exports.keyBy = zipWith.keyBy;
2377
2577
  exports.maxBy = zipWith.maxBy;
2378
2578
  exports.minBy = zipWith.minBy;
@@ -2383,17 +2583,13 @@ exports.shuffle = zipWith.shuffle;
2383
2583
  exports.takeRightWhile = zipWith.takeRightWhile;
2384
2584
  exports.takeWhile = zipWith.takeWhile;
2385
2585
  exports.toFilled = zipWith.toFilled;
2386
- exports.union = zipWith.union;
2387
2586
  exports.unionBy = zipWith.unionBy;
2388
2587
  exports.unionWith = zipWith.unionWith;
2389
- exports.uniqBy = zipWith.uniqBy;
2390
2588
  exports.uniqWith = zipWith.uniqWith;
2391
- exports.unzip = zipWith.unzip;
2392
2589
  exports.unzipWith = zipWith.unzipWith;
2393
2590
  exports.xor = zipWith.xor;
2394
2591
  exports.xorBy = zipWith.xorBy;
2395
2592
  exports.xorWith = zipWith.xorWith;
2396
- exports.zip = zipWith.zip;
2397
2593
  exports.zipObject = zipWith.zipObject;
2398
2594
  exports.zipWith = zipWith.zipWith;
2399
2595
  exports.AbortError = promise_index.AbortError;
@@ -2410,16 +2606,15 @@ exports.partial = unary.partial;
2410
2606
  exports.partialRight = unary.partialRight;
2411
2607
  exports.unary = unary.unary;
2412
2608
  exports.noop = noop.noop;
2413
- exports.mean = sumBy.mean;
2414
- exports.meanBy = sumBy.meanBy;
2415
- exports.median = sumBy.median;
2416
- exports.medianBy = sumBy.medianBy;
2417
- exports.range = sumBy.range;
2418
- exports.rangeRight = sumBy.rangeRight;
2419
- exports.sum = sumBy.sum;
2420
- exports.sumBy = sumBy.sumBy;
2609
+ exports.mean = rangeRight.mean;
2610
+ exports.meanBy = rangeRight.meanBy;
2611
+ exports.median = rangeRight.median;
2612
+ exports.medianBy = rangeRight.medianBy;
2613
+ exports.range = rangeRight.range;
2614
+ exports.rangeRight = rangeRight.rangeRight;
2421
2615
  exports.randomInt = randomInt.randomInt;
2422
2616
  exports.clone = toMerged.clone;
2617
+ exports.findKey = toMerged.findKey;
2423
2618
  exports.flattenObject = toMerged.flattenObject;
2424
2619
  exports.invert = toMerged.invert;
2425
2620
  exports.isObjectLike = toMerged.isObjectLike;
@@ -2447,6 +2642,7 @@ exports.lowerFirst = upperFirst.lowerFirst;
2447
2642
  exports.pascalCase = upperFirst.pascalCase;
2448
2643
  exports.unescape = upperFirst.unescape;
2449
2644
  exports.upperFirst = upperFirst.upperFirst;
2645
+ exports.words = upperFirst.words;
2450
2646
  exports.invariant = util_index.invariant;
2451
2647
  exports.ary = ary;
2452
2648
  exports.attempt = attempt;
@@ -2471,10 +2667,12 @@ exports.defaultTo = defaultTo;
2471
2667
  exports.defaults = defaults;
2472
2668
  exports.defer = defer;
2473
2669
  exports.difference = difference;
2670
+ exports.differenceBy = differenceBy;
2474
2671
  exports.drop = drop;
2475
2672
  exports.dropRight = dropRight;
2476
2673
  exports.dropRightWhile = dropRightWhile;
2477
2674
  exports.dropWhile = dropWhile;
2675
+ exports.each = forEach;
2478
2676
  exports.endsWith = endsWith;
2479
2677
  exports.escape = escape;
2480
2678
  exports.every = every;
@@ -2491,6 +2689,7 @@ exports.flip = flip;
2491
2689
  exports.floor = floor;
2492
2690
  exports.flow = flow;
2493
2691
  exports.flowRight = flowRight;
2692
+ exports.forEach = forEach;
2494
2693
  exports.fromPairs = fromPairs;
2495
2694
  exports.get = get;
2496
2695
  exports.has = has;
@@ -2508,6 +2707,7 @@ exports.isArrayLike = isArrayLike;
2508
2707
  exports.isArrayLikeObject = isArrayLikeObject;
2509
2708
  exports.isBoolean = isBoolean;
2510
2709
  exports.isDate = isDate;
2710
+ exports.isEmpty = isEmpty;
2511
2711
  exports.isEqualWith = isEqualWith;
2512
2712
  exports.isError = isError;
2513
2713
  exports.isFinite = isFinite;
@@ -2527,6 +2727,7 @@ exports.isSymbol = isSymbol;
2527
2727
  exports.isTypedArray = isTypedArray;
2528
2728
  exports.isWeakMap = isWeakMap;
2529
2729
  exports.isWeakSet = isWeakSet;
2730
+ exports.iteratee = iteratee;
2530
2731
  exports.join = join;
2531
2732
  exports.kebabCase = kebabCase;
2532
2733
  exports.last = last;
@@ -2550,6 +2751,7 @@ exports.property = property;
2550
2751
  exports.random = random;
2551
2752
  exports.rearg = rearg;
2552
2753
  exports.repeat = repeat;
2754
+ exports.replace = replace;
2553
2755
  exports.rest = rest;
2554
2756
  exports.round = round;
2555
2757
  exports.sample = sample;
@@ -2562,6 +2764,8 @@ exports.sortBy = sortBy;
2562
2764
  exports.spread = spread;
2563
2765
  exports.startCase = startCase;
2564
2766
  exports.startsWith = startsWith;
2767
+ exports.sum = sum;
2768
+ exports.sumBy = sumBy;
2565
2769
  exports.tail = tail;
2566
2770
  exports.take = take;
2567
2771
  exports.takeRight = takeRight;
@@ -2580,9 +2784,13 @@ exports.toString = toString;
2580
2784
  exports.trim = trim;
2581
2785
  exports.trimEnd = trimEnd;
2582
2786
  exports.trimStart = trimStart;
2787
+ exports.union = union;
2583
2788
  exports.uniq = uniq;
2789
+ exports.uniqBy = uniqBy;
2584
2790
  exports.uniqueId = uniqueId;
2585
2791
  exports.unset = unset;
2792
+ exports.unzip = unzip;
2586
2793
  exports.upperCase = upperCase;
2587
2794
  exports.without = without;
2795
+ exports.zip = zip;
2588
2796
  exports.zipObjectDeep = zipObjectDeep;