es-toolkit 1.27.0 → 1.28.0-dev.910

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 (119) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/_chunk/{isWeakSet-D8h8bS.js → isWeakSet-CvIdTA.js} +5 -0
  3. package/dist/_chunk/{toMerged-CPY8Ug.js → toMerged-AV73JV.js} +77 -65
  4. package/dist/_chunk/{upperFirst-DK_rTF.js → upperFirst-CorAVn.js} +1 -0
  5. package/dist/array/differenceBy.d.mts +10 -3
  6. package/dist/array/differenceBy.d.ts +10 -3
  7. package/dist/array/differenceWith.d.mts +11 -4
  8. package/dist/array/differenceWith.d.ts +11 -4
  9. package/dist/array/flatMap.d.mts +1 -1
  10. package/dist/array/flatMap.d.ts +1 -1
  11. package/dist/array/intersectionBy.d.mts +16 -5
  12. package/dist/array/intersectionBy.d.ts +16 -5
  13. package/dist/array/intersectionWith.d.mts +16 -4
  14. package/dist/array/intersectionWith.d.ts +16 -4
  15. package/dist/browser.global.js +1 -1
  16. package/dist/browser.global.js.map +1 -1
  17. package/dist/compat/array/dropRightWhile.d.mts +2 -2
  18. package/dist/compat/array/dropRightWhile.d.ts +2 -2
  19. package/dist/compat/array/dropRightWhile.mjs +2 -0
  20. package/dist/compat/array/dropWhile.d.mts +2 -2
  21. package/dist/compat/array/dropWhile.d.ts +2 -2
  22. package/dist/compat/array/dropWhile.mjs +2 -0
  23. package/dist/compat/array/every.d.mts +6 -6
  24. package/dist/compat/array/every.d.ts +6 -6
  25. package/dist/compat/array/every.mjs +2 -0
  26. package/dist/compat/array/filter.d.mts +4 -4
  27. package/dist/compat/array/filter.d.ts +4 -4
  28. package/dist/compat/array/filter.mjs +2 -0
  29. package/dist/compat/array/find.d.mts +6 -6
  30. package/dist/compat/array/find.d.ts +6 -6
  31. package/dist/compat/array/find.mjs +2 -0
  32. package/dist/compat/array/findIndex.d.mts +3 -3
  33. package/dist/compat/array/findIndex.d.ts +3 -3
  34. package/dist/compat/array/findIndex.mjs +2 -0
  35. package/dist/compat/array/findLastIndex.d.mts +3 -3
  36. package/dist/compat/array/findLastIndex.d.ts +3 -3
  37. package/dist/compat/array/findLastIndex.mjs +2 -0
  38. package/dist/compat/array/some.d.mts +5 -5
  39. package/dist/compat/array/some.d.ts +5 -5
  40. package/dist/compat/array/some.mjs +2 -0
  41. package/dist/compat/array/uniqBy.d.mts +34 -13
  42. package/dist/compat/array/uniqBy.d.ts +34 -13
  43. package/dist/compat/array/uniqBy.mjs +3 -16
  44. package/dist/compat/function/debounce.d.mts +7 -5
  45. package/dist/compat/function/debounce.d.ts +7 -5
  46. package/dist/compat/function/throttle.d.mts +3 -4
  47. package/dist/compat/function/throttle.d.ts +3 -4
  48. package/dist/compat/function/throttle.mjs +6 -1
  49. package/dist/compat/index.d.mts +13 -2
  50. package/dist/compat/index.d.ts +13 -2
  51. package/dist/compat/index.js +211 -69
  52. package/dist/compat/index.mjs +11 -1
  53. package/dist/compat/math/add.d.mts +18 -0
  54. package/dist/compat/math/add.d.ts +18 -0
  55. package/dist/compat/math/add.mjs +5 -0
  56. package/dist/compat/object/assignIn.d.mts +103 -0
  57. package/dist/compat/object/assignIn.d.ts +103 -0
  58. package/dist/compat/object/assignIn.mjs +20 -0
  59. package/dist/compat/object/cloneDeep.mjs +2 -24
  60. package/dist/compat/object/cloneDeepWith.d.mts +38 -0
  61. package/dist/compat/object/cloneDeepWith.d.ts +38 -0
  62. package/dist/compat/object/cloneDeepWith.mjs +35 -0
  63. package/dist/compat/object/keysIn.d.mts +26 -0
  64. package/dist/compat/object/keysIn.d.ts +26 -0
  65. package/dist/compat/object/keysIn.mjs +53 -0
  66. package/dist/compat/predicate/isElement.d.mts +13 -0
  67. package/dist/compat/predicate/isElement.d.ts +13 -0
  68. package/dist/compat/predicate/isElement.mjs +8 -0
  69. package/dist/compat/string/toUpper.d.mts +20 -0
  70. package/dist/compat/string/toUpper.d.ts +20 -0
  71. package/dist/compat/string/toUpper.mjs +7 -0
  72. package/dist/compat/string/trim.mjs +1 -1
  73. package/dist/compat/string/trimEnd.mjs +1 -1
  74. package/dist/compat/string/trimStart.mjs +1 -1
  75. package/dist/compat/string/words.d.mts +15 -0
  76. package/dist/compat/string/words.d.ts +15 -0
  77. package/dist/compat/string/words.mjs +10 -0
  78. package/dist/compat/util/gt.d.mts +15 -0
  79. package/dist/compat/util/gt.d.ts +15 -0
  80. package/dist/compat/util/gt.mjs +10 -0
  81. package/dist/compat/util/gte.d.mts +15 -0
  82. package/dist/compat/util/gte.d.ts +15 -0
  83. package/dist/compat/util/gte.mjs +10 -0
  84. package/dist/compat/util/iteratee.d.mts +1 -1
  85. package/dist/compat/util/iteratee.d.ts +1 -1
  86. package/dist/compat/util/toArray.d.mts +15 -0
  87. package/dist/compat/util/toArray.d.ts +15 -0
  88. package/dist/compat/util/toArray.mjs +20 -0
  89. package/dist/function/debounce.d.mts +24 -22
  90. package/dist/function/debounce.d.ts +24 -22
  91. package/dist/function/index.d.mts +2 -2
  92. package/dist/function/index.d.ts +2 -2
  93. package/dist/function/partial.d.mts +533 -15
  94. package/dist/function/partial.d.ts +533 -15
  95. package/dist/function/partialRight.d.mts +610 -15
  96. package/dist/function/partialRight.d.ts +610 -15
  97. package/dist/function/throttle.d.mts +7 -5
  98. package/dist/function/throttle.d.ts +7 -5
  99. package/dist/index.d.mts +4 -2
  100. package/dist/index.d.ts +4 -2
  101. package/dist/index.js +5 -3
  102. package/dist/index.mjs +2 -0
  103. package/dist/object/cloneDeep.mjs +3 -110
  104. package/dist/object/cloneDeepWith.d.mts +38 -0
  105. package/dist/object/cloneDeepWith.d.ts +38 -0
  106. package/dist/object/cloneDeepWith.mjs +121 -0
  107. package/dist/object/index.d.mts +1 -0
  108. package/dist/object/index.d.ts +1 -0
  109. package/dist/object/index.js +2 -1
  110. package/dist/object/index.mjs +1 -0
  111. package/dist/predicate/index.d.mts +1 -0
  112. package/dist/predicate/index.d.ts +1 -0
  113. package/dist/predicate/index.js +2 -1
  114. package/dist/predicate/index.mjs +1 -0
  115. package/dist/predicate/isBuffer.d.mts +21 -0
  116. package/dist/predicate/isBuffer.d.ts +21 -0
  117. package/dist/predicate/isBuffer.mjs +5 -0
  118. package/dist/string/index.js +1 -1
  119. package/package.json +1 -1
@@ -8,10 +8,10 @@ const unary = require('../_chunk/unary-CcTNuC.js');
8
8
  const noop = require('../_chunk/noop-2IwLUk.js');
9
9
  const rangeRight = require('../_chunk/rangeRight-w3WrXN.js');
10
10
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
11
- const toMerged = require('../_chunk/toMerged-CPY8Ug.js');
11
+ const toMerged = require('../_chunk/toMerged-AV73JV.js');
12
12
  const isPlainObject$1 = require('../_chunk/isPlainObject-octpoD.js');
13
- const isWeakSet$1 = require('../_chunk/isWeakSet-D8h8bS.js');
14
- const upperFirst = require('../_chunk/upperFirst-DK_rTF.js');
13
+ const isWeakSet$1 = require('../_chunk/isWeakSet-CvIdTA.js');
14
+ const upperFirst = require('../_chunk/upperFirst-CorAVn.js');
15
15
  const util_index = require('../util/index.js');
16
16
 
17
17
  function castArray(value) {
@@ -21,7 +21,7 @@ function castArray(value) {
21
21
  return Array.isArray(value) ? value : [value];
22
22
  }
23
23
 
24
- function toArray(value) {
24
+ function toArray$1(value) {
25
25
  return Array.isArray(value) ? value : Array.from(value);
26
26
  }
27
27
 
@@ -34,7 +34,7 @@ function chunk(arr, size = 1) {
34
34
  if (size === 0 || !isArrayLike(arr)) {
35
35
  return [];
36
36
  }
37
- return zipWith.chunk(toArray(arr), size);
37
+ return zipWith.chunk(toArray$1(arr), size);
38
38
  }
39
39
 
40
40
  function compact(arr) {
@@ -56,7 +56,7 @@ function difference(arr, ...values) {
56
56
  if (!isArrayLikeObject(arr)) {
57
57
  return [];
58
58
  }
59
- const arr1 = toArray(arr);
59
+ const arr1 = toArray$1(arr);
60
60
  const arr2 = [];
61
61
  for (let i = 0; i < values.length; i++) {
62
62
  const value = values[i];
@@ -71,7 +71,7 @@ function last(array) {
71
71
  if (!isArrayLike(array)) {
72
72
  return undefined;
73
73
  }
74
- return zipWith.last(toArray(array));
74
+ return zipWith.last(toArray$1(array));
75
75
  }
76
76
 
77
77
  function flattenArrayLike(values) {
@@ -354,29 +354,39 @@ function matches(source) {
354
354
  };
355
355
  }
356
356
 
357
- function cloneDeep(obj) {
358
- if (typeof obj !== 'object') {
359
- return toMerged.cloneDeep(obj);
360
- }
361
- switch (Object.prototype.toString.call(obj)) {
362
- case isWeakSet$1.numberTag:
363
- case isWeakSet$1.stringTag:
364
- case isWeakSet$1.booleanTag: {
365
- const result = new obj.constructor(obj?.valueOf());
366
- toMerged.copyProperties(result, obj);
367
- return result;
357
+ function cloneDeepWith(obj, cloneValue) {
358
+ return toMerged.cloneDeepWith(obj, (value, key, object, stack) => {
359
+ const cloned = cloneValue?.(value, key, object, stack);
360
+ if (cloned != null) {
361
+ return cloned;
368
362
  }
369
- case isWeakSet$1.argumentsTag: {
370
- const result = {};
371
- toMerged.copyProperties(result, obj);
372
- result.length = obj.length;
373
- result[Symbol.iterator] = obj[Symbol.iterator];
374
- return result;
363
+ if (typeof obj !== 'object') {
364
+ return undefined;
375
365
  }
376
- default: {
377
- return toMerged.cloneDeep(obj);
366
+ switch (Object.prototype.toString.call(obj)) {
367
+ case isWeakSet$1.numberTag:
368
+ case isWeakSet$1.stringTag:
369
+ case isWeakSet$1.booleanTag: {
370
+ const result = new obj.constructor(obj?.valueOf());
371
+ toMerged.copyProperties(result, obj);
372
+ return result;
373
+ }
374
+ case isWeakSet$1.argumentsTag: {
375
+ const result = {};
376
+ toMerged.copyProperties(result, obj);
377
+ result.length = obj.length;
378
+ result[Symbol.iterator] = obj[Symbol.iterator];
379
+ return result;
380
+ }
381
+ default: {
382
+ return undefined;
383
+ }
378
384
  }
379
- }
385
+ });
386
+ }
387
+
388
+ function cloneDeep(obj) {
389
+ return cloneDeepWith(obj);
380
390
  }
381
391
 
382
392
  const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
@@ -520,7 +530,7 @@ function drop(collection, itemsCount = 1, guard) {
520
530
  return [];
521
531
  }
522
532
  itemsCount = guard ? 1 : toInteger(itemsCount);
523
- return zipWith.drop(toArray(collection), itemsCount);
533
+ return zipWith.drop(toArray$1(collection), itemsCount);
524
534
  }
525
535
 
526
536
  function dropRight(collection, itemsCount = 1, guard) {
@@ -528,7 +538,7 @@ function dropRight(collection, itemsCount = 1, guard) {
528
538
  return [];
529
539
  }
530
540
  itemsCount = guard ? 1 : toInteger(itemsCount);
531
- return zipWith.dropRight(toArray(collection), itemsCount);
541
+ return zipWith.dropRight(toArray$1(collection), itemsCount);
532
542
  }
533
543
 
534
544
  function dropRightWhile(arr, predicate) {
@@ -552,6 +562,8 @@ function dropRightWhileImpl(arr, predicate) {
552
562
  return zipWith.dropRightWhile(arr, matches(predicate));
553
563
  }
554
564
  }
565
+ case 'symbol':
566
+ case 'number':
555
567
  case 'string': {
556
568
  return zipWith.dropRightWhile(arr, property(predicate));
557
569
  }
@@ -562,7 +574,7 @@ function dropWhile(arr, predicate) {
562
574
  if (!isArrayLike(arr)) {
563
575
  return [];
564
576
  }
565
- return dropWhileImpl(toArray(arr), predicate);
577
+ return dropWhileImpl(toArray$1(arr), predicate);
566
578
  }
567
579
  function dropWhileImpl(arr, predicate) {
568
580
  switch (typeof predicate) {
@@ -579,6 +591,8 @@ function dropWhileImpl(arr, predicate) {
579
591
  return zipWith.dropWhile(arr, matches(predicate));
580
592
  }
581
593
  }
594
+ case 'number':
595
+ case 'symbol':
582
596
  case 'string': {
583
597
  return zipWith.dropWhile(arr, property(predicate));
584
598
  }
@@ -632,6 +646,8 @@ function every(source, doesMatch, guard) {
632
646
  return values.every(matches(doesMatch));
633
647
  }
634
648
  }
649
+ case 'symbol':
650
+ case 'number':
635
651
  case 'string': {
636
652
  return values.every(property(doesMatch));
637
653
  }
@@ -693,6 +709,8 @@ function filter(source, predicate) {
693
709
  ? collection.filter(matchesProperty(predicate[0], predicate[1]))
694
710
  : collection.filter(matches(predicate));
695
711
  }
712
+ case 'symbol':
713
+ case 'number':
696
714
  case 'string': {
697
715
  return collection.filter(property(predicate));
698
716
  }
@@ -729,6 +747,8 @@ function find(source, doesMatch) {
729
747
  return values.find(matches(doesMatch));
730
748
  }
731
749
  }
750
+ case 'symbol':
751
+ case 'number':
732
752
  case 'string': {
733
753
  return values.find(property(doesMatch));
734
754
  }
@@ -760,6 +780,8 @@ function findIndex(arr, doesMatch, fromIndex = 0) {
760
780
  }
761
781
  break;
762
782
  }
783
+ case 'number':
784
+ case 'symbol':
763
785
  case 'string': {
764
786
  index = subArray.findIndex(property(doesMatch));
765
787
  }
@@ -777,7 +799,7 @@ function findLastIndex(arr, doesMatch, fromIndex = arr ? arr.length - 1 : 0) {
777
799
  else {
778
800
  fromIndex = Math.min(fromIndex, arr.length - 1);
779
801
  }
780
- const subArray = toArray(arr).slice(0, fromIndex + 1);
802
+ const subArray = toArray$1(arr).slice(0, fromIndex + 1);
781
803
  switch (typeof doesMatch) {
782
804
  case 'function': {
783
805
  return subArray.findLastIndex(doesMatch);
@@ -792,6 +814,8 @@ function findLastIndex(arr, doesMatch, fromIndex = arr ? arr.length - 1 : 0) {
792
814
  return subArray.findLastIndex(matches(doesMatch));
793
815
  }
794
816
  }
817
+ case 'number':
818
+ case 'symbol':
795
819
  case 'string': {
796
820
  return subArray.findLastIndex(property(doesMatch));
797
821
  }
@@ -855,7 +879,7 @@ function head(arr) {
855
879
  if (!isArrayLike(arr)) {
856
880
  return undefined;
857
881
  }
858
- return zipWith.head(toArray(arr));
882
+ return zipWith.head(toArray$1(arr));
859
883
  }
860
884
 
861
885
  function includes(source, target, fromIndex, guard) {
@@ -1091,7 +1115,7 @@ function sample(collection) {
1091
1115
  return undefined;
1092
1116
  }
1093
1117
  if (isArrayLike(collection)) {
1094
- return zipWith.sample(toArray(collection));
1118
+ return zipWith.sample(toArray$1(collection));
1095
1119
  }
1096
1120
  return zipWith.sample(Object.values(collection));
1097
1121
  }
@@ -1176,6 +1200,8 @@ function some(source, predicate, guard) {
1176
1200
  return values.some(matches(predicate));
1177
1201
  }
1178
1202
  }
1203
+ case 'number':
1204
+ case 'symbol':
1179
1205
  case 'string': {
1180
1206
  return values.some(property(predicate));
1181
1207
  }
@@ -1197,7 +1223,7 @@ function tail(arr) {
1197
1223
  if (!isArrayLike(arr)) {
1198
1224
  return [];
1199
1225
  }
1200
- return zipWith.tail(toArray(arr));
1226
+ return zipWith.tail(toArray$1(arr));
1201
1227
  }
1202
1228
 
1203
1229
  function take(arr, count = 1, guard) {
@@ -1205,7 +1231,7 @@ function take(arr, count = 1, guard) {
1205
1231
  if (count < 1 || !isArrayLike(arr)) {
1206
1232
  return [];
1207
1233
  }
1208
- return zipWith.take(toArray(arr), count);
1234
+ return zipWith.take(toArray$1(arr), count);
1209
1235
  }
1210
1236
 
1211
1237
  function takeRight(arr, count = 1, guard) {
@@ -1213,7 +1239,7 @@ function takeRight(arr, count = 1, guard) {
1213
1239
  if (count <= 0 || !isArrayLike(arr)) {
1214
1240
  return [];
1215
1241
  }
1216
- return zipWith.takeRight(toArray(arr), count);
1242
+ return zipWith.takeRight(toArray$1(arr), count);
1217
1243
  }
1218
1244
 
1219
1245
  function union(...arrays) {
@@ -1229,21 +1255,11 @@ function uniq(arr) {
1229
1255
  return zipWith.uniq(Array.from(arr));
1230
1256
  }
1231
1257
 
1232
- function uniqBy(arr, ...values) {
1233
- if (!isArrayLikeObject(arr)) {
1258
+ function uniqBy(array, iteratee$1) {
1259
+ if (!isArrayLikeObject(array)) {
1234
1260
  return [];
1235
1261
  }
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));
1262
+ return zipWith.uniqBy(Array.from(array), iteratee(iteratee$1));
1247
1263
  }
1248
1264
 
1249
1265
  function unzip(array) {
@@ -1624,7 +1640,16 @@ function throttle(func, throttleMs = 0, options = {}) {
1624
1640
  options = {};
1625
1641
  }
1626
1642
  const { leading = true, trailing = true, signal } = options;
1627
- return debounce(func, throttleMs, { leading, trailing, signal, maxWait: throttleMs });
1643
+ return debounce(func, throttleMs, {
1644
+ leading,
1645
+ trailing,
1646
+ signal,
1647
+ maxWait: throttleMs,
1648
+ });
1649
+ }
1650
+
1651
+ function add(value, other) {
1652
+ return value + other;
1628
1653
  }
1629
1654
 
1630
1655
  function decimalAdjust(type, number, precision = 0) {
@@ -1811,6 +1836,90 @@ function sum(array) {
1811
1836
  return sumBy(array);
1812
1837
  }
1813
1838
 
1839
+ function isPrototype(value) {
1840
+ const constructor = value.constructor;
1841
+ const prototype = typeof constructor === 'function' ? constructor.prototype : Object.prototype;
1842
+ return value === prototype;
1843
+ }
1844
+
1845
+ function isTypedArray(x) {
1846
+ return isPlainObject$1.isTypedArray(x);
1847
+ }
1848
+
1849
+ function times(n, getValue) {
1850
+ n = toInteger(n);
1851
+ if (n < 1 || !Number.isSafeInteger(n)) {
1852
+ return [];
1853
+ }
1854
+ const result = new Array(n);
1855
+ for (let i = 0; i < n; i++) {
1856
+ result[i] = typeof getValue === 'function' ? getValue(i) : i;
1857
+ }
1858
+ return result;
1859
+ }
1860
+
1861
+ function keysIn(object) {
1862
+ if (object == null) {
1863
+ return [];
1864
+ }
1865
+ switch (typeof object) {
1866
+ case 'object':
1867
+ case 'function': {
1868
+ if (isArrayLike(object)) {
1869
+ return arrayLikeKeysIn(object);
1870
+ }
1871
+ if (isPrototype(object)) {
1872
+ return prototypeKeysIn(object);
1873
+ }
1874
+ return keysInImpl(object);
1875
+ }
1876
+ default: {
1877
+ return keysInImpl(Object(object));
1878
+ }
1879
+ }
1880
+ }
1881
+ function keysInImpl(object) {
1882
+ const result = [];
1883
+ for (const key in object) {
1884
+ result.push(key);
1885
+ }
1886
+ return result;
1887
+ }
1888
+ function prototypeKeysIn(object) {
1889
+ const keys = keysInImpl(object);
1890
+ return keys.filter(key => key !== 'constructor');
1891
+ }
1892
+ function arrayLikeKeysIn(object) {
1893
+ const indices = times(object.length, index => `${index}`);
1894
+ const filteredKeys = new Set(indices);
1895
+ if (isWeakSet$1.isBuffer(object)) {
1896
+ filteredKeys.add('offset');
1897
+ filteredKeys.add('parent');
1898
+ }
1899
+ if (isTypedArray(object)) {
1900
+ filteredKeys.add('buffer');
1901
+ filteredKeys.add('byteLength');
1902
+ filteredKeys.add('byteOffset');
1903
+ }
1904
+ return [...indices, ...keysInImpl(object).filter(key => !filteredKeys.has(key))];
1905
+ }
1906
+
1907
+ function assignIn(object, ...sources) {
1908
+ for (let i = 0; i < sources.length; i++) {
1909
+ assignInImpl(object, sources[i]);
1910
+ }
1911
+ return object;
1912
+ }
1913
+ function assignInImpl(object, source) {
1914
+ const keys = keysIn(source);
1915
+ for (let i = 0; i < keys.length; i++) {
1916
+ const key = keys[i];
1917
+ if (!isWeakSet$1.eq(object[key], source[key])) {
1918
+ object[key] = source[key];
1919
+ }
1920
+ }
1921
+ }
1922
+
1814
1923
  function defaults(object, ...sources) {
1815
1924
  object = Object(object);
1816
1925
  const objectProto = Object.prototype;
@@ -1921,10 +2030,6 @@ function isPlainObject(object) {
1921
2030
  return Object.getPrototypeOf(object) === proto;
1922
2031
  }
1923
2032
 
1924
- function isTypedArray(x) {
1925
- return isPlainObject$1.isTypedArray(x);
1926
- }
1927
-
1928
2033
  function mergeWith(object, ...otherArgs) {
1929
2034
  const sources = otherArgs.slice(0, -1);
1930
2035
  const merge = otherArgs[otherArgs.length - 1];
@@ -2179,10 +2284,8 @@ function isDate(value) {
2179
2284
  return isWeakSet$1.isDate(value);
2180
2285
  }
2181
2286
 
2182
- function isPrototype(value) {
2183
- const constructor = value.constructor;
2184
- const prototype = typeof constructor === 'function' ? constructor.prototype : Object.prototype;
2185
- return value === prototype;
2287
+ function isElement(value) {
2288
+ return toMerged.isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
2186
2289
  }
2187
2290
 
2188
2291
  function isEmpty(value) {
@@ -2444,6 +2547,10 @@ function template(string, options, guard) {
2444
2547
  return result;
2445
2548
  }
2446
2549
 
2550
+ function toUpper(value) {
2551
+ return toString(value).toUpperCase();
2552
+ }
2553
+
2447
2554
  function trim(str, chars, guard) {
2448
2555
  if (str == null) {
2449
2556
  return '';
@@ -2457,7 +2564,7 @@ function trim(str, chars, guard) {
2457
2564
  }
2458
2565
  case 'object': {
2459
2566
  if (Array.isArray(chars)) {
2460
- return upperFirst.trim(str, chars.map(x => x.toString()));
2567
+ return upperFirst.trim(str, chars.flatMap(x => x.toString().split('')));
2461
2568
  }
2462
2569
  else {
2463
2570
  return upperFirst.trim(str, chars.toString().split(''));
@@ -2479,7 +2586,7 @@ function trimEnd(str, chars, guard) {
2479
2586
  }
2480
2587
  case 'object': {
2481
2588
  if (Array.isArray(chars)) {
2482
- return upperFirst.trimEnd(str, chars.map(x => x.toString()));
2589
+ return upperFirst.trimEnd(str, chars.flatMap(x => x.toString().split('')));
2483
2590
  }
2484
2591
  else {
2485
2592
  return upperFirst.trimEnd(str, chars.toString().split(''));
@@ -2501,7 +2608,7 @@ function trimStart(str, chars, guard) {
2501
2608
  }
2502
2609
  case 'object': {
2503
2610
  if (Array.isArray(chars)) {
2504
- return upperFirst.trimStart(str, chars.map(x => x.toString()));
2611
+ return upperFirst.trimStart(str, chars.flatMap(x => x.toString().split('')));
2505
2612
  }
2506
2613
  else {
2507
2614
  return upperFirst.trimStart(str, chars.toString().split(''));
@@ -2514,6 +2621,12 @@ function upperCase(str) {
2514
2621
  return upperFirst.upperCase(normalizeForCase(str));
2515
2622
  }
2516
2623
 
2624
+ function words(str, pattern = upperFirst.CASE_SPLIT_PATTERN) {
2625
+ const input = toString(str);
2626
+ const words = Array.from(input.match(pattern) ?? []);
2627
+ return words.filter(x => x !== '');
2628
+ }
2629
+
2517
2630
  function constant(value) {
2518
2631
  return () => value;
2519
2632
  }
@@ -2525,16 +2638,34 @@ function defaultTo(value, defaultValue) {
2525
2638
  return value;
2526
2639
  }
2527
2640
 
2528
- function times(n, getValue) {
2529
- n = toInteger(n);
2530
- if (n < 1 || !Number.isSafeInteger(n)) {
2641
+ function gt(value, other) {
2642
+ if (typeof value === 'string' && typeof other === 'string') {
2643
+ return value > other;
2644
+ }
2645
+ return toNumber(value) > toNumber(other);
2646
+ }
2647
+
2648
+ function gte(value, other) {
2649
+ if (typeof value === 'string' && typeof other === 'string') {
2650
+ return value >= other;
2651
+ }
2652
+ return toNumber(value) >= toNumber(other);
2653
+ }
2654
+
2655
+ function toArray(value) {
2656
+ if (value == null) {
2531
2657
  return [];
2532
2658
  }
2533
- const result = new Array(n);
2534
- for (let i = 0; i < n; i++) {
2535
- result[i] = typeof getValue === 'function' ? getValue(i) : i;
2659
+ if (isArrayLike(value) || isMap(value)) {
2660
+ return Array.from(value);
2536
2661
  }
2537
- return result;
2662
+ if (typeof value === 'string') {
2663
+ return value.split('');
2664
+ }
2665
+ if (typeof value === 'object') {
2666
+ return Object.values(value);
2667
+ }
2668
+ return [];
2538
2669
  }
2539
2670
 
2540
2671
  const MAX_ARRAY_LENGTH = 4_294_967_295;
@@ -2624,6 +2755,7 @@ exports.toMerged = toMerged.toMerged;
2624
2755
  exports.isPrimitive = isPlainObject$1.isPrimitive;
2625
2756
  exports.eq = isWeakSet$1.eq;
2626
2757
  exports.isBlob = isWeakSet$1.isBlob;
2758
+ exports.isBuffer = isWeakSet$1.isBuffer;
2627
2759
  exports.isEqual = isWeakSet$1.isEqual;
2628
2760
  exports.isFile = isWeakSet$1.isFile;
2629
2761
  exports.isFunction = isWeakSet$1.isFunction;
@@ -2642,9 +2774,10 @@ exports.lowerFirst = upperFirst.lowerFirst;
2642
2774
  exports.pascalCase = upperFirst.pascalCase;
2643
2775
  exports.unescape = upperFirst.unescape;
2644
2776
  exports.upperFirst = upperFirst.upperFirst;
2645
- exports.words = upperFirst.words;
2646
2777
  exports.invariant = util_index.invariant;
2778
+ exports.add = add;
2647
2779
  exports.ary = ary;
2780
+ exports.assignIn = assignIn;
2648
2781
  exports.attempt = attempt;
2649
2782
  exports.before = before;
2650
2783
  exports.bind = bind;
@@ -2655,6 +2788,7 @@ exports.ceil = ceil;
2655
2788
  exports.chunk = chunk;
2656
2789
  exports.clamp = clamp;
2657
2790
  exports.cloneDeep = cloneDeep;
2791
+ exports.cloneDeepWith = cloneDeepWith;
2658
2792
  exports.compact = compact;
2659
2793
  exports.concat = concat;
2660
2794
  exports.conforms = conforms;
@@ -2676,6 +2810,7 @@ exports.each = forEach;
2676
2810
  exports.endsWith = endsWith;
2677
2811
  exports.escape = escape;
2678
2812
  exports.every = every;
2813
+ exports.extend = assignIn;
2679
2814
  exports.fill = fill;
2680
2815
  exports.filter = filter;
2681
2816
  exports.find = find;
@@ -2692,6 +2827,8 @@ exports.flowRight = flowRight;
2692
2827
  exports.forEach = forEach;
2693
2828
  exports.fromPairs = fromPairs;
2694
2829
  exports.get = get;
2830
+ exports.gt = gt;
2831
+ exports.gte = gte;
2695
2832
  exports.has = has;
2696
2833
  exports.head = head;
2697
2834
  exports.inRange = inRange;
@@ -2707,6 +2844,7 @@ exports.isArrayLike = isArrayLike;
2707
2844
  exports.isArrayLikeObject = isArrayLikeObject;
2708
2845
  exports.isBoolean = isBoolean;
2709
2846
  exports.isDate = isDate;
2847
+ exports.isElement = isElement;
2710
2848
  exports.isEmpty = isEmpty;
2711
2849
  exports.isEqualWith = isEqualWith;
2712
2850
  exports.isError = isError;
@@ -2730,6 +2868,7 @@ exports.isWeakSet = isWeakSet;
2730
2868
  exports.iteratee = iteratee;
2731
2869
  exports.join = join;
2732
2870
  exports.kebabCase = kebabCase;
2871
+ exports.keysIn = keysIn;
2733
2872
  exports.last = last;
2734
2873
  exports.lowerCase = lowerCase;
2735
2874
  exports.mapKeys = mapKeys;
@@ -2773,6 +2912,7 @@ exports.template = template;
2773
2912
  exports.templateSettings = templateSettings;
2774
2913
  exports.throttle = throttle;
2775
2914
  exports.times = times;
2915
+ exports.toArray = toArray;
2776
2916
  exports.toDefaulted = toDefaulted;
2777
2917
  exports.toFinite = toFinite;
2778
2918
  exports.toInteger = toInteger;
@@ -2781,6 +2921,7 @@ exports.toNumber = toNumber;
2781
2921
  exports.toPath = toPath;
2782
2922
  exports.toSafeInteger = toSafeInteger;
2783
2923
  exports.toString = toString;
2924
+ exports.toUpper = toUpper;
2784
2925
  exports.trim = trim;
2785
2926
  exports.trimEnd = trimEnd;
2786
2927
  exports.trimStart = trimStart;
@@ -2792,5 +2933,6 @@ exports.unset = unset;
2792
2933
  exports.unzip = unzip;
2793
2934
  exports.upperCase = upperCase;
2794
2935
  exports.without = without;
2936
+ exports.words = words;
2795
2937
  exports.zip = zip;
2796
2938
  exports.zipObjectDeep = zipObjectDeep;
@@ -56,6 +56,7 @@ export { omitBy } from '../object/omitBy.mjs';
56
56
  export { pickBy } from '../object/pickBy.mjs';
57
57
  export { toMerged } from '../object/toMerged.mjs';
58
58
  export { isBlob } from '../predicate/isBlob.mjs';
59
+ export { isBuffer } from '../predicate/isBuffer.mjs';
59
60
  export { isEqual } from '../predicate/isEqual.mjs';
60
61
  export { eq } from './util/eq.mjs';
61
62
  export { isFile } from '../predicate/isFile.mjs';
@@ -69,7 +70,6 @@ export { delay } from '../promise/delay.mjs';
69
70
  export { timeout } from '../promise/timeout.mjs';
70
71
  export { withTimeout } from '../promise/withTimeout.mjs';
71
72
  export { capitalize } from '../string/capitalize.mjs';
72
- export { words } from '../string/words.mjs';
73
73
  export { constantCase } from '../string/constantCase.mjs';
74
74
  export { deburr } from '../string/deburr.mjs';
75
75
  export { escapeRegExp } from '../string/escapeRegExp.mjs';
@@ -137,6 +137,7 @@ export { rearg } from './function/rearg.mjs';
137
137
  export { rest } from './function/rest.mjs';
138
138
  export { spread } from './function/spread.mjs';
139
139
  export { throttle } from './function/throttle.mjs';
140
+ export { add } from './math/add.mjs';
140
141
  export { ceil } from './math/ceil.mjs';
141
142
  export { clamp } from './math/clamp.mjs';
142
143
  export { floor } from './math/floor.mjs';
@@ -148,12 +149,15 @@ export { random } from './math/random.mjs';
148
149
  export { round } from './math/round.mjs';
149
150
  export { sum } from './math/sum.mjs';
150
151
  export { sumBy } from './math/sumBy.mjs';
152
+ export { assignIn, assignIn as extend } from './object/assignIn.mjs';
151
153
  export { cloneDeep } from './object/cloneDeep.mjs';
154
+ export { cloneDeepWith } from './object/cloneDeepWith.mjs';
152
155
  export { defaults } from './object/defaults.mjs';
153
156
  export { fromPairs } from './object/fromPairs.mjs';
154
157
  export { get } from './object/get.mjs';
155
158
  export { has } from './object/has.mjs';
156
159
  export { invertBy } from './object/invertBy.mjs';
160
+ export { keysIn } from './object/keysIn.mjs';
157
161
  export { mapKeys } from './object/mapKeys.mjs';
158
162
  export { mapValues } from './object/mapValues.mjs';
159
163
  export { merge } from './object/merge.mjs';
@@ -173,6 +177,7 @@ export { isArrayLike } from './predicate/isArrayLike.mjs';
173
177
  export { isArrayLikeObject } from './predicate/isArrayLikeObject.mjs';
174
178
  export { isBoolean } from './predicate/isBoolean.mjs';
175
179
  export { isDate } from './predicate/isDate.mjs';
180
+ export { isElement } from './predicate/isElement.mjs';
176
181
  export { isEmpty } from './predicate/isEmpty.mjs';
177
182
  export { isEqualWith } from './predicate/isEqualWith.mjs';
178
183
  export { isError } from './predicate/isError.mjs';
@@ -209,14 +214,19 @@ export { snakeCase } from './string/snakeCase.mjs';
209
214
  export { startCase } from './string/startCase.mjs';
210
215
  export { startsWith } from './string/startsWith.mjs';
211
216
  export { template, templateSettings } from './string/template.mjs';
217
+ export { toUpper } from './string/toUpper.mjs';
212
218
  export { trim } from './string/trim.mjs';
213
219
  export { trimEnd } from './string/trimEnd.mjs';
214
220
  export { trimStart } from './string/trimStart.mjs';
215
221
  export { upperCase } from './string/upperCase.mjs';
222
+ export { words } from './string/words.mjs';
216
223
  export { constant } from './util/constant.mjs';
217
224
  export { defaultTo } from './util/defaultTo.mjs';
225
+ export { gt } from './util/gt.mjs';
226
+ export { gte } from './util/gte.mjs';
218
227
  export { iteratee } from './util/iteratee.mjs';
219
228
  export { times } from './util/times.mjs';
229
+ export { toArray } from './util/toArray.mjs';
220
230
  export { toFinite } from './util/toFinite.mjs';
221
231
  export { toInteger } from './util/toInteger.mjs';
222
232
  export { toLength } from './util/toLength.mjs';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Adds two numbers while safely handling `NaN` values.
3
+ *
4
+ * This function takes two numbers and returns their sum. If either of the numbers is `NaN`,
5
+ * the function returns `NaN`.
6
+ *
7
+ * @param {number} value - The first number to add.
8
+ * @param {number} other - The second number to add.
9
+ * @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`.
10
+ *
11
+ * @example
12
+ * const result1 = add(2, 3); // result1 will be 5
13
+ * const result2 = add(5, NaN); // result2 will be NaN
14
+ * const result3 = add(NaN, 10); // result3 will be NaN
15
+ */
16
+ declare function add(value: number, other: number): number;
17
+
18
+ export { add };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Adds two numbers while safely handling `NaN` values.
3
+ *
4
+ * This function takes two numbers and returns their sum. If either of the numbers is `NaN`,
5
+ * the function returns `NaN`.
6
+ *
7
+ * @param {number} value - The first number to add.
8
+ * @param {number} other - The second number to add.
9
+ * @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`.
10
+ *
11
+ * @example
12
+ * const result1 = add(2, 3); // result1 will be 5
13
+ * const result2 = add(5, NaN); // result2 will be NaN
14
+ * const result3 = add(NaN, 10); // result3 will be NaN
15
+ */
16
+ declare function add(value: number, other: number): number;
17
+
18
+ export { add };
@@ -0,0 +1,5 @@
1
+ function add(value, other) {
2
+ return value + other;
3
+ }
4
+
5
+ export { add };