es-toolkit 1.29.0 → 1.30.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 (134) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/_chunk/{rangeRight-w3WrXN.js → range-HnEIT7.js} +0 -17
  3. package/dist/_chunk/{zipWith-Bb2eZI.js → zipWith-nbzldx.js} +11 -10
  4. package/dist/array/index.d.mts +1 -0
  5. package/dist/array/index.d.ts +1 -0
  6. package/dist/array/index.js +12 -2
  7. package/dist/array/index.mjs +1 -0
  8. package/dist/array/pull.d.mts +19 -0
  9. package/dist/array/pull.d.ts +19 -0
  10. package/dist/array/pull.mjs +11 -0
  11. package/dist/browser.global.js +1 -1
  12. package/dist/browser.global.js.map +1 -1
  13. package/dist/compat/_internal/isIndex.mjs +2 -2
  14. package/dist/compat/_internal/isPrototype.mjs +1 -1
  15. package/dist/compat/array/differenceWith.d.mts +91 -0
  16. package/dist/compat/array/differenceWith.d.ts +91 -0
  17. package/dist/compat/array/differenceWith.mjs +19 -0
  18. package/dist/compat/array/map.d.mts +182 -0
  19. package/dist/compat/array/map.d.ts +182 -0
  20. package/dist/compat/array/map.mjs +21 -0
  21. package/dist/compat/array/nth.d.mts +14 -0
  22. package/dist/compat/array/nth.d.ts +14 -0
  23. package/dist/compat/array/nth.mjs +15 -0
  24. package/dist/compat/array/pull.d.mts +19 -0
  25. package/dist/compat/array/pull.d.ts +19 -0
  26. package/dist/compat/array/pull.mjs +8 -0
  27. package/dist/compat/array/takeRightWhile.d.mts +84 -0
  28. package/dist/compat/array/takeRightWhile.d.ts +84 -0
  29. package/dist/compat/array/takeRightWhile.mjs +15 -0
  30. package/dist/compat/function/after.d.mts +31 -0
  31. package/dist/compat/function/after.d.ts +31 -0
  32. package/dist/compat/function/after.mjs +15 -0
  33. package/dist/compat/function/delay.d.mts +29 -0
  34. package/dist/compat/function/delay.d.ts +29 -0
  35. package/dist/compat/function/delay.mjs +10 -0
  36. package/dist/compat/function/nthArg.d.mts +22 -0
  37. package/dist/compat/function/nthArg.d.ts +22 -0
  38. package/dist/compat/function/nthArg.mjs +9 -0
  39. package/dist/compat/index.d.mts +30 -13
  40. package/dist/compat/index.d.ts +30 -13
  41. package/dist/compat/index.js +369 -56
  42. package/dist/compat/index.mjs +31 -13
  43. package/dist/compat/math/range.d.mts +47 -0
  44. package/dist/compat/math/range.d.ts +47 -0
  45. package/dist/compat/math/range.mjs +26 -0
  46. package/dist/compat/math/rangeRight.d.mts +47 -0
  47. package/dist/compat/math/rangeRight.d.ts +47 -0
  48. package/dist/compat/math/rangeRight.mjs +26 -0
  49. package/dist/compat/math/sumBy.d.mts +2 -2
  50. package/dist/compat/math/sumBy.d.ts +2 -2
  51. package/dist/compat/object/findKey.d.mts +58 -0
  52. package/dist/compat/object/findKey.d.ts +58 -0
  53. package/dist/compat/object/findKey.mjs +30 -0
  54. package/dist/compat/object/keys.d.mts +22 -0
  55. package/dist/compat/object/keys.d.ts +22 -0
  56. package/dist/compat/object/keys.mjs +32 -0
  57. package/dist/compat/object/propertyOf.d.mts +22 -0
  58. package/dist/compat/object/propertyOf.d.ts +22 -0
  59. package/dist/compat/object/propertyOf.mjs +9 -0
  60. package/dist/compat/predicate/isArrayLike.d.mts +1 -1
  61. package/dist/compat/predicate/isArrayLike.d.ts +1 -1
  62. package/dist/compat/predicate/isArrayLikeObject.d.mts +1 -1
  63. package/dist/compat/predicate/isArrayLikeObject.d.ts +1 -1
  64. package/dist/compat/predicate/isElement.d.mts +1 -1
  65. package/dist/compat/predicate/isElement.d.ts +1 -1
  66. package/dist/compat/predicate/isFinite.d.mts +1 -1
  67. package/dist/compat/predicate/isFinite.d.ts +1 -1
  68. package/dist/compat/predicate/isNaN.d.mts +1 -1
  69. package/dist/compat/predicate/isNaN.d.ts +1 -1
  70. package/dist/compat/predicate/isObject.d.mts +1 -1
  71. package/dist/compat/predicate/isObject.d.ts +1 -1
  72. package/dist/compat/predicate/isObjectLike.d.mts +1 -1
  73. package/dist/compat/predicate/isObjectLike.d.ts +1 -1
  74. package/dist/compat/string/deburr.d.mts +22 -0
  75. package/dist/compat/string/deburr.d.ts +22 -0
  76. package/dist/compat/string/deburr.mjs +8 -0
  77. package/dist/compat/string/escapeRegExp.d.mts +14 -0
  78. package/dist/compat/string/escapeRegExp.d.ts +14 -0
  79. package/dist/compat/string/escapeRegExp.mjs +8 -0
  80. package/dist/compat/string/lowerFirst.d.mts +14 -0
  81. package/dist/compat/string/lowerFirst.d.ts +14 -0
  82. package/dist/compat/string/lowerFirst.mjs +8 -0
  83. package/dist/compat/string/toLower.d.mts +20 -0
  84. package/dist/compat/string/toLower.d.ts +20 -0
  85. package/dist/compat/string/toLower.mjs +7 -0
  86. package/dist/compat/string/unescape.d.mts +16 -0
  87. package/dist/compat/string/unescape.d.ts +16 -0
  88. package/dist/compat/string/unescape.mjs +8 -0
  89. package/dist/compat/string/upperFirst.d.mts +14 -0
  90. package/dist/compat/string/upperFirst.d.ts +14 -0
  91. package/dist/compat/string/upperFirst.mjs +8 -0
  92. package/dist/compat/util/invoke.d.mts +23 -0
  93. package/dist/compat/util/invoke.d.ts +23 -0
  94. package/dist/compat/util/invoke.mjs +48 -0
  95. package/dist/compat/util/lt.d.mts +15 -0
  96. package/dist/compat/util/lt.d.ts +15 -0
  97. package/dist/compat/util/lt.mjs +10 -0
  98. package/dist/compat/util/lte.d.mts +15 -0
  99. package/dist/compat/util/lte.d.ts +15 -0
  100. package/dist/compat/util/lte.mjs +10 -0
  101. package/dist/compat/util/method.d.mts +22 -0
  102. package/dist/compat/util/method.d.ts +22 -0
  103. package/dist/compat/util/method.mjs +9 -0
  104. package/dist/compat/util/now.d.mts +18 -0
  105. package/dist/compat/util/now.d.ts +18 -0
  106. package/dist/compat/util/now.mjs +5 -0
  107. package/dist/compat/util/stubArray.d.mts +10 -0
  108. package/dist/compat/util/stubArray.d.ts +10 -0
  109. package/dist/compat/util/stubArray.mjs +5 -0
  110. package/dist/compat/util/stubFalse.d.mts +10 -0
  111. package/dist/compat/util/stubFalse.d.ts +10 -0
  112. package/dist/compat/util/stubFalse.mjs +5 -0
  113. package/dist/compat/util/stubObject.d.mts +10 -0
  114. package/dist/compat/util/stubObject.d.ts +10 -0
  115. package/dist/compat/util/stubObject.mjs +5 -0
  116. package/dist/compat/util/stubString.d.mts +10 -0
  117. package/dist/compat/util/stubString.d.ts +10 -0
  118. package/dist/compat/util/stubString.mjs +5 -0
  119. package/dist/compat/util/stubTrue.d.mts +10 -0
  120. package/dist/compat/util/stubTrue.d.ts +10 -0
  121. package/dist/compat/util/stubTrue.mjs +5 -0
  122. package/dist/compat/util/toArray.mjs +0 -3
  123. package/dist/compat/util/toPlainObject.d.mts +16 -0
  124. package/dist/compat/util/toPlainObject.d.ts +16 -0
  125. package/dist/compat/util/toPlainObject.mjs +24 -0
  126. package/dist/index.d.mts +1 -0
  127. package/dist/index.d.ts +1 -0
  128. package/dist/index.js +13 -12
  129. package/dist/index.mjs +1 -0
  130. package/dist/math/index.js +26 -10
  131. package/package.json +1 -1
  132. package/dist/compat/util/uniqueId.d.mts +0 -25
  133. package/dist/compat/util/uniqueId.d.ts +0 -25
  134. package/dist/compat/util/uniqueId.mjs +0 -7
@@ -2,16 +2,16 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const zipWith = require('../_chunk/zipWith-Bb2eZI.js');
5
+ const zipWith = require('../_chunk/zipWith-nbzldx.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 rangeRight = require('../_chunk/rangeRight-w3WrXN.js');
9
+ const range$1 = require('../_chunk/range-HnEIT7.js');
10
10
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
11
11
  const toMerged = require('../_chunk/toMerged-DGFrN7.js');
12
12
  const isPlainObject$1 = require('../_chunk/isPlainObject-octpoD.js');
13
13
  const isWeakSet$1 = require('../_chunk/isWeakSet-CvIdTA.js');
14
- const upperFirst = require('../_chunk/upperFirst-CorAVn.js');
14
+ const upperFirst$1 = require('../_chunk/upperFirst-CorAVn.js');
15
15
  const util_index = require('../util/index.js');
16
16
 
17
17
  function castArray(value) {
@@ -390,10 +390,10 @@ function cloneDeep(obj) {
390
390
  }
391
391
 
392
392
  const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
393
- function isIndex(value) {
393
+ function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
394
394
  switch (typeof value) {
395
395
  case 'number': {
396
- return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
396
+ return Number.isInteger(value) && value >= 0 && value < length;
397
397
  }
398
398
  case 'symbol': {
399
399
  return false;
@@ -496,6 +496,18 @@ function differenceBy(arr, ..._values) {
496
496
  return zipWith.differenceBy(Array.from(arr), values, iteratee(iteratee$1));
497
497
  }
498
498
 
499
+ function differenceWith(array, ...values) {
500
+ if (!isArrayLikeObject(array)) {
501
+ return [];
502
+ }
503
+ const comparator = last(values);
504
+ const flattenedValues = flattenArrayLike(values);
505
+ if (typeof comparator === 'function') {
506
+ return zipWith.differenceWith(Array.from(array), flattenedValues, comparator);
507
+ }
508
+ return zipWith.difference(Array.from(array), flattenedValues);
509
+ }
510
+
499
511
  function isSymbol(value) {
500
512
  return typeof value === 'symbol' || value instanceof Symbol;
501
513
  }
@@ -863,7 +875,7 @@ function forEach(collection, callback = unary.identity) {
863
875
  if (!collection) {
864
876
  return collection;
865
877
  }
866
- const keys = isArrayLike(collection) || Array.isArray(collection) ? rangeRight.range(0, collection.length) : Object.keys(collection);
878
+ const keys = isArrayLike(collection) || Array.isArray(collection) ? range$1.range(0, collection.length) : Object.keys(collection);
867
879
  for (let i = 0; i < keys.length; i++) {
868
880
  const key = keys[i];
869
881
  const value = collection[key];
@@ -1008,6 +1020,32 @@ function lastIndexOf(array, searchElement, fromIndex) {
1008
1020
  return Array.from(array).lastIndexOf(searchElement, index);
1009
1021
  }
1010
1022
 
1023
+ function map(collection, _iteratee) {
1024
+ if (!collection) {
1025
+ return [];
1026
+ }
1027
+ const keys = isArrayLike(collection) || Array.isArray(collection) ? range$1.range(0, collection.length) : Object.keys(collection);
1028
+ const iteratee$1 = iteratee(_iteratee ?? unary.identity);
1029
+ const result = new Array(keys.length);
1030
+ for (let i = 0; i < keys.length; i++) {
1031
+ const key = keys[i];
1032
+ const value = collection[key];
1033
+ result[i] = iteratee$1(value, key, collection);
1034
+ }
1035
+ return result;
1036
+ }
1037
+
1038
+ function nth(array, n = 0) {
1039
+ if (!isArrayLikeObject(array) || array.length === 0) {
1040
+ return undefined;
1041
+ }
1042
+ n = toInteger(n);
1043
+ if (n < 0) {
1044
+ n += array.length;
1045
+ }
1046
+ return array[n];
1047
+ }
1048
+
1011
1049
  function getPriority(a) {
1012
1050
  if (typeof a === 'symbol') {
1013
1051
  return 1;
@@ -1129,6 +1167,10 @@ function orderBy(collection, criteria, orders, guard) {
1129
1167
  .map(item => item.original);
1130
1168
  }
1131
1169
 
1170
+ function pull(arr, ...valuesToRemove) {
1171
+ return zipWith.pull(arr, flatten(valuesToRemove));
1172
+ }
1173
+
1132
1174
  function sample(collection) {
1133
1175
  if (collection == null) {
1134
1176
  return undefined;
@@ -1261,6 +1303,15 @@ function takeRight(arr, count = 1, guard) {
1261
1303
  return zipWith.takeRight(toArray$1(arr), count);
1262
1304
  }
1263
1305
 
1306
+ function takeRightWhile(_array, predicate) {
1307
+ if (!isArrayLikeObject(_array)) {
1308
+ return [];
1309
+ }
1310
+ const array = toArray$1(_array);
1311
+ const index = array.findLastIndex(unary.negate(iteratee(predicate)));
1312
+ return array.slice(index + 1);
1313
+ }
1314
+
1264
1315
  function union(...arrays) {
1265
1316
  const validArrays = arrays.filter(isArrayLikeObject);
1266
1317
  const flattened = flatten(validArrays, 1);
@@ -1339,6 +1390,18 @@ function zipObjectDeep(keys, values) {
1339
1390
  return result;
1340
1391
  }
1341
1392
 
1393
+ function after(n, func) {
1394
+ if (typeof func !== 'function') {
1395
+ throw new TypeError('Expected a function');
1396
+ }
1397
+ n = toInteger(n);
1398
+ return function (...args) {
1399
+ if (--n < 1) {
1400
+ return func.apply(this, args);
1401
+ }
1402
+ };
1403
+ }
1404
+
1342
1405
  function ary(func, n = func.length, guard) {
1343
1406
  if (guard) {
1344
1407
  n = func.length;
@@ -1598,6 +1661,13 @@ function defer(func, ...args) {
1598
1661
  return setTimeout(func, 1, ...args);
1599
1662
  }
1600
1663
 
1664
+ function delay(func, wait, ...args) {
1665
+ if (typeof func !== 'function') {
1666
+ throw new TypeError('Expected a function');
1667
+ }
1668
+ return setTimeout(func, toNumber(wait) || 0, ...args);
1669
+ }
1670
+
1601
1671
  function flip(func) {
1602
1672
  return function (...args) {
1603
1673
  return func.apply(this, args.reverse());
@@ -1620,6 +1690,12 @@ function flowRight(...funcs) {
1620
1690
  return unary.flowRight(...flattenFuncs);
1621
1691
  }
1622
1692
 
1693
+ function nthArg(n = 0) {
1694
+ return function (...args) {
1695
+ return args.at(toInteger(n));
1696
+ };
1697
+ }
1698
+
1623
1699
  function rearg(func, ...indices) {
1624
1700
  const flattenIndices = flatten(indices);
1625
1701
  return function (...args) {
@@ -1700,7 +1776,7 @@ function clamp(value, bound1, bound2) {
1700
1776
  if (Number.isNaN(bound2)) {
1701
1777
  bound2 = 0;
1702
1778
  }
1703
- return rangeRight.clamp(value, bound1, bound2);
1779
+ return range$1.clamp(value, bound1, bound2);
1704
1780
  }
1705
1781
 
1706
1782
  function floor(number, precision = 0) {
@@ -1729,7 +1805,7 @@ function inRange(value, minimum, maximum) {
1729
1805
  if (minimum === maximum) {
1730
1806
  return false;
1731
1807
  }
1732
- return rangeRight.inRange(value, minimum, maximum);
1808
+ return range$1.inRange(value, minimum, maximum);
1733
1809
  }
1734
1810
 
1735
1811
  function max(items = []) {
@@ -1830,6 +1906,50 @@ function random(...args) {
1830
1906
  }
1831
1907
  }
1832
1908
 
1909
+ function range(start, end, step) {
1910
+ if (step && typeof step !== 'number' && isIterateeCall(start, end, step)) {
1911
+ end = step = undefined;
1912
+ }
1913
+ start = toFinite(start);
1914
+ if (end === undefined) {
1915
+ end = start;
1916
+ start = 0;
1917
+ }
1918
+ else {
1919
+ end = toFinite(end);
1920
+ }
1921
+ step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
1922
+ const length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
1923
+ const result = new Array(length);
1924
+ for (let index = 0; index < length; index++) {
1925
+ result[index] = start;
1926
+ start += step;
1927
+ }
1928
+ return result;
1929
+ }
1930
+
1931
+ function rangeRight(start, end, step) {
1932
+ if (step && typeof step !== 'number' && isIterateeCall(start, end, step)) {
1933
+ end = step = undefined;
1934
+ }
1935
+ start = toFinite(start);
1936
+ if (end === undefined) {
1937
+ end = start;
1938
+ start = 0;
1939
+ }
1940
+ else {
1941
+ end = toFinite(end);
1942
+ }
1943
+ step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
1944
+ const length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
1945
+ const result = new Array(length);
1946
+ for (let index = length - 1; index >= 0; index--) {
1947
+ result[index] = start;
1948
+ start += step;
1949
+ }
1950
+ return result;
1951
+ }
1952
+
1833
1953
  function round(number, precision = 0) {
1834
1954
  return decimalAdjust('round', number, precision);
1835
1955
  }
@@ -1856,7 +1976,7 @@ function sum(array) {
1856
1976
  }
1857
1977
 
1858
1978
  function isPrototype(value) {
1859
- const constructor = value.constructor;
1979
+ const constructor = value?.constructor;
1860
1980
  const prototype = typeof constructor === 'function' ? constructor.prototype : Object.prototype;
1861
1981
  return value === prototype;
1862
1982
  }
@@ -1957,6 +2077,29 @@ function defaults(object, ...sources) {
1957
2077
  return object;
1958
2078
  }
1959
2079
 
2080
+ function findKey(obj, predicate) {
2081
+ if (!isObject(obj)) {
2082
+ return undefined;
2083
+ }
2084
+ return findKeyImpl(obj, predicate);
2085
+ }
2086
+ function findKeyImpl(obj, predicate) {
2087
+ if (typeof predicate === 'function') {
2088
+ return toMerged.findKey(obj, predicate);
2089
+ }
2090
+ if (typeof predicate === 'object') {
2091
+ if (Array.isArray(predicate)) {
2092
+ const key = predicate[0];
2093
+ const value = predicate[1];
2094
+ return toMerged.findKey(obj, matchesProperty(key, value));
2095
+ }
2096
+ return toMerged.findKey(obj, matches(predicate));
2097
+ }
2098
+ if (typeof predicate === 'string') {
2099
+ return toMerged.findKey(obj, property(predicate));
2100
+ }
2101
+ }
2102
+
1960
2103
  function fromPairs(pairs) {
1961
2104
  if (!isArrayLike(pairs) && !(pairs instanceof Map)) {
1962
2105
  return {};
@@ -1991,6 +2134,31 @@ function invertBy(object, iteratee) {
1991
2134
  return result;
1992
2135
  }
1993
2136
 
2137
+ function keys(object) {
2138
+ if (isArrayLike(object)) {
2139
+ return arrayLikeKeys(object);
2140
+ }
2141
+ const result = Object.keys(Object(object));
2142
+ if (!isPrototype(object)) {
2143
+ return result;
2144
+ }
2145
+ return result.filter(key => key !== 'constructor');
2146
+ }
2147
+ function arrayLikeKeys(object) {
2148
+ const indices = times(object.length, index => `${index}`);
2149
+ const filteredKeys = new Set(indices);
2150
+ if (isWeakSet$1.isBuffer(object)) {
2151
+ filteredKeys.add('offset');
2152
+ filteredKeys.add('parent');
2153
+ }
2154
+ if (isTypedArray(object)) {
2155
+ filteredKeys.add('buffer');
2156
+ filteredKeys.add('byteLength');
2157
+ filteredKeys.add('byteOffset');
2158
+ }
2159
+ return [...indices, ...Object.keys(object).filter(key => !filteredKeys.has(key))];
2160
+ }
2161
+
1994
2162
  function mapKeys(object, getNewKey) {
1995
2163
  getNewKey = getNewKey ?? unary.identity;
1996
2164
  switch (typeof getNewKey) {
@@ -2260,6 +2428,12 @@ function pick(obj, ...keysArr) {
2260
2428
  return result;
2261
2429
  }
2262
2430
 
2431
+ function propertyOf(object) {
2432
+ return function (path) {
2433
+ return get(object, path);
2434
+ };
2435
+ }
2436
+
2263
2437
  function toDefaulted(object, ...sources) {
2264
2438
  const cloned = cloneDeep(object);
2265
2439
  return defaults(cloned, ...sources);
@@ -2418,7 +2592,11 @@ function normalizeForCase(str) {
2418
2592
  }
2419
2593
 
2420
2594
  function camelCase(str) {
2421
- return upperFirst.camelCase(normalizeForCase(str));
2595
+ return upperFirst$1.camelCase(normalizeForCase(str));
2596
+ }
2597
+
2598
+ function deburr(str) {
2599
+ return upperFirst$1.deburr(toString(str));
2422
2600
  }
2423
2601
 
2424
2602
  function endsWith(str, target, position = str.length) {
@@ -2426,19 +2604,27 @@ function endsWith(str, target, position = str.length) {
2426
2604
  }
2427
2605
 
2428
2606
  function escape(string) {
2429
- return upperFirst.escape(toString(string));
2607
+ return upperFirst$1.escape(toString(string));
2608
+ }
2609
+
2610
+ function escapeRegExp(str) {
2611
+ return upperFirst$1.escapeRegExp(toString(str));
2430
2612
  }
2431
2613
 
2432
2614
  function kebabCase(str) {
2433
- return upperFirst.kebabCase(normalizeForCase(str));
2615
+ return upperFirst$1.kebabCase(normalizeForCase(str));
2434
2616
  }
2435
2617
 
2436
2618
  function lowerCase(str) {
2437
- return upperFirst.lowerCase(normalizeForCase(str));
2619
+ return upperFirst$1.lowerCase(normalizeForCase(str));
2620
+ }
2621
+
2622
+ function lowerFirst(str) {
2623
+ return upperFirst$1.lowerFirst(toString(str));
2438
2624
  }
2439
2625
 
2440
2626
  function pad(str, length, chars = ' ') {
2441
- return upperFirst.pad(toString(str), length, chars);
2627
+ return upperFirst$1.pad(toString(str), length, chars);
2442
2628
  }
2443
2629
 
2444
2630
  function padEnd(str, length = 0, chars = ' ') {
@@ -2461,11 +2647,11 @@ function replace(target = '', pattern, replacement) {
2461
2647
  }
2462
2648
 
2463
2649
  function snakeCase(str) {
2464
- return upperFirst.snakeCase(normalizeForCase(str));
2650
+ return upperFirst$1.snakeCase(normalizeForCase(str));
2465
2651
  }
2466
2652
 
2467
2653
  function startCase(str) {
2468
- const words = upperFirst.words(normalizeForCase(str).trim());
2654
+ const words = upperFirst$1.words(normalizeForCase(str).trim());
2469
2655
  let result = '';
2470
2656
  for (let i = 0; i < words.length; i++) {
2471
2657
  const word = words[i];
@@ -2566,6 +2752,10 @@ function template(string, options, guard) {
2566
2752
  return result;
2567
2753
  }
2568
2754
 
2755
+ function toLower(value) {
2756
+ return toString(value).toLowerCase();
2757
+ }
2758
+
2569
2759
  function toUpper(value) {
2570
2760
  return toString(value).toUpperCase();
2571
2761
  }
@@ -2579,14 +2769,14 @@ function trim(str, chars, guard) {
2579
2769
  }
2580
2770
  switch (typeof chars) {
2581
2771
  case 'string': {
2582
- return upperFirst.trim(str, chars.toString().split(''));
2772
+ return upperFirst$1.trim(str, chars.toString().split(''));
2583
2773
  }
2584
2774
  case 'object': {
2585
2775
  if (Array.isArray(chars)) {
2586
- return upperFirst.trim(str, chars.flatMap(x => x.toString().split('')));
2776
+ return upperFirst$1.trim(str, chars.flatMap(x => x.toString().split('')));
2587
2777
  }
2588
2778
  else {
2589
- return upperFirst.trim(str, chars.toString().split(''));
2779
+ return upperFirst$1.trim(str, chars.toString().split(''));
2590
2780
  }
2591
2781
  }
2592
2782
  }
@@ -2601,14 +2791,14 @@ function trimEnd(str, chars, guard) {
2601
2791
  }
2602
2792
  switch (typeof chars) {
2603
2793
  case 'string': {
2604
- return upperFirst.trimEnd(str, chars.toString().split(''));
2794
+ return upperFirst$1.trimEnd(str, chars.toString().split(''));
2605
2795
  }
2606
2796
  case 'object': {
2607
2797
  if (Array.isArray(chars)) {
2608
- return upperFirst.trimEnd(str, chars.flatMap(x => x.toString().split('')));
2798
+ return upperFirst$1.trimEnd(str, chars.flatMap(x => x.toString().split('')));
2609
2799
  }
2610
2800
  else {
2611
- return upperFirst.trimEnd(str, chars.toString().split(''));
2801
+ return upperFirst$1.trimEnd(str, chars.toString().split(''));
2612
2802
  }
2613
2803
  }
2614
2804
  }
@@ -2623,24 +2813,32 @@ function trimStart(str, chars, guard) {
2623
2813
  }
2624
2814
  switch (typeof chars) {
2625
2815
  case 'string': {
2626
- return upperFirst.trimStart(str, chars.toString().split(''));
2816
+ return upperFirst$1.trimStart(str, chars.toString().split(''));
2627
2817
  }
2628
2818
  case 'object': {
2629
2819
  if (Array.isArray(chars)) {
2630
- return upperFirst.trimStart(str, chars.flatMap(x => x.toString().split('')));
2820
+ return upperFirst$1.trimStart(str, chars.flatMap(x => x.toString().split('')));
2631
2821
  }
2632
2822
  else {
2633
- return upperFirst.trimStart(str, chars.toString().split(''));
2823
+ return upperFirst$1.trimStart(str, chars.toString().split(''));
2634
2824
  }
2635
2825
  }
2636
2826
  }
2637
2827
  }
2638
2828
 
2829
+ function unescape(str) {
2830
+ return upperFirst$1.unescape(toString(str));
2831
+ }
2832
+
2639
2833
  function upperCase(str) {
2640
- return upperFirst.upperCase(normalizeForCase(str));
2834
+ return upperFirst$1.upperCase(normalizeForCase(str));
2835
+ }
2836
+
2837
+ function upperFirst(str) {
2838
+ return upperFirst$1.upperFirst(toString(str));
2641
2839
  }
2642
2840
 
2643
- function words(str, pattern = upperFirst.CASE_SPLIT_PATTERN) {
2841
+ function words(str, pattern = upperFirst$1.CASE_SPLIT_PATTERN) {
2644
2842
  const input = toString(str);
2645
2843
  const words = Array.from(input.match(pattern) ?? []);
2646
2844
  return words.filter(x => x !== '');
@@ -2671,6 +2869,92 @@ function gte(value, other) {
2671
2869
  return toNumber(value) >= toNumber(other);
2672
2870
  }
2673
2871
 
2872
+ function invoke(object, path, args = []) {
2873
+ if (object == null) {
2874
+ return;
2875
+ }
2876
+ switch (typeof path) {
2877
+ case 'string': {
2878
+ if (typeof object === 'object' && Object.hasOwn(object, path)) {
2879
+ return invokeImpl(object, [path], args);
2880
+ }
2881
+ return invokeImpl(object, toPath(path), args);
2882
+ }
2883
+ case 'number':
2884
+ case 'symbol': {
2885
+ return invokeImpl(object, [path], args);
2886
+ }
2887
+ default: {
2888
+ if (Array.isArray(path)) {
2889
+ return invokeImpl(object, path, args);
2890
+ }
2891
+ else {
2892
+ return invokeImpl(object, [path], args);
2893
+ }
2894
+ }
2895
+ }
2896
+ }
2897
+ function invokeImpl(object, path, args) {
2898
+ const parent = get(object, path.slice(0, -1), object);
2899
+ if (parent == null) {
2900
+ return undefined;
2901
+ }
2902
+ let lastKey = last(path);
2903
+ let lastValue = lastKey?.valueOf();
2904
+ if (typeof lastValue === 'number') {
2905
+ lastKey = toKey(lastValue);
2906
+ }
2907
+ else {
2908
+ lastKey = String(lastKey);
2909
+ }
2910
+ const func = get(parent, lastKey);
2911
+ return func?.apply(parent, args);
2912
+ }
2913
+
2914
+ function lt(value, other) {
2915
+ if (typeof value === 'string' && typeof other === 'string') {
2916
+ return value < other;
2917
+ }
2918
+ return toNumber(value) < toNumber(other);
2919
+ }
2920
+
2921
+ function lte(value, other) {
2922
+ if (typeof value === 'string' && typeof other === 'string') {
2923
+ return value <= other;
2924
+ }
2925
+ return toNumber(value) <= toNumber(other);
2926
+ }
2927
+
2928
+ function method(path, ...args) {
2929
+ return function (object) {
2930
+ return invoke(object, path, args);
2931
+ };
2932
+ }
2933
+
2934
+ function now() {
2935
+ return Date.now();
2936
+ }
2937
+
2938
+ function stubArray() {
2939
+ return [];
2940
+ }
2941
+
2942
+ function stubFalse() {
2943
+ return false;
2944
+ }
2945
+
2946
+ function stubObject() {
2947
+ return {};
2948
+ }
2949
+
2950
+ function stubString() {
2951
+ return '';
2952
+ }
2953
+
2954
+ function stubTrue() {
2955
+ return true;
2956
+ }
2957
+
2674
2958
  function toArray(value) {
2675
2959
  if (value == null) {
2676
2960
  return [];
@@ -2678,9 +2962,6 @@ function toArray(value) {
2678
2962
  if (isArrayLike(value) || isMap(value)) {
2679
2963
  return Array.from(value);
2680
2964
  }
2681
- if (typeof value === 'string') {
2682
- return value.split('');
2683
- }
2684
2965
  if (typeof value === 'object') {
2685
2966
  return Object.values(value);
2686
2967
  }
@@ -2697,6 +2978,27 @@ function toLength(value) {
2697
2978
  return clamp(length, 0, MAX_ARRAY_LENGTH);
2698
2979
  }
2699
2980
 
2981
+ function toPlainObject(value) {
2982
+ const plainObject = {};
2983
+ const valueKeys = keysIn(value);
2984
+ for (let i = 0; i < valueKeys.length; i++) {
2985
+ const key = valueKeys[i];
2986
+ const objValue = value[key];
2987
+ if (key === '__proto__') {
2988
+ Object.defineProperty(plainObject, key, {
2989
+ configurable: true,
2990
+ enumerable: true,
2991
+ value: objValue,
2992
+ writable: true,
2993
+ });
2994
+ }
2995
+ else {
2996
+ plainObject[key] = objValue;
2997
+ }
2998
+ }
2999
+ return plainObject;
3000
+ }
3001
+
2700
3002
  const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
2701
3003
 
2702
3004
  function toSafeInteger(value) {
@@ -2706,15 +3008,8 @@ function toSafeInteger(value) {
2706
3008
  return clamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
2707
3009
  }
2708
3010
 
2709
- let idCounter = 0;
2710
- function uniqueId(prefix = '') {
2711
- const id = ++idCounter;
2712
- return `${prefix}${id}`;
2713
- }
2714
-
2715
3011
  exports.at = zipWith.at;
2716
3012
  exports.countBy = zipWith.countBy;
2717
- exports.differenceWith = zipWith.differenceWith;
2718
3013
  exports.flatMap = zipWith.flatMap;
2719
3014
  exports.flatMapDeep = zipWith.flatMapDeep;
2720
3015
  exports.forEachRight = zipWith.forEachRight;
@@ -2730,7 +3025,6 @@ exports.partition = zipWith.partition;
2730
3025
  exports.pullAt = zipWith.pullAt;
2731
3026
  exports.sampleSize = zipWith.sampleSize;
2732
3027
  exports.shuffle = zipWith.shuffle;
2733
- exports.takeRightWhile = zipWith.takeRightWhile;
2734
3028
  exports.takeWhile = zipWith.takeWhile;
2735
3029
  exports.toFilled = zipWith.toFilled;
2736
3030
  exports.unionBy = zipWith.unionBy;
@@ -2744,10 +3038,8 @@ exports.zipObject = zipWith.zipObject;
2744
3038
  exports.zipWith = zipWith.zipWith;
2745
3039
  exports.AbortError = promise_index.AbortError;
2746
3040
  exports.TimeoutError = promise_index.TimeoutError;
2747
- exports.delay = promise_index.delay;
2748
3041
  exports.timeout = promise_index.timeout;
2749
3042
  exports.withTimeout = promise_index.withTimeout;
2750
- exports.after = unary.after;
2751
3043
  exports.identity = unary.identity;
2752
3044
  exports.memoize = unary.memoize;
2753
3045
  exports.negate = unary.negate;
@@ -2756,15 +3048,12 @@ exports.partial = unary.partial;
2756
3048
  exports.partialRight = unary.partialRight;
2757
3049
  exports.unary = unary.unary;
2758
3050
  exports.noop = noop.noop;
2759
- exports.mean = rangeRight.mean;
2760
- exports.meanBy = rangeRight.meanBy;
2761
- exports.median = rangeRight.median;
2762
- exports.medianBy = rangeRight.medianBy;
2763
- exports.range = rangeRight.range;
2764
- exports.rangeRight = rangeRight.rangeRight;
3051
+ exports.mean = range$1.mean;
3052
+ exports.meanBy = range$1.meanBy;
3053
+ exports.median = range$1.median;
3054
+ exports.medianBy = range$1.medianBy;
2765
3055
  exports.randomInt = randomInt.randomInt;
2766
3056
  exports.clone = toMerged.clone;
2767
- exports.findKey = toMerged.findKey;
2768
3057
  exports.flattenObject = toMerged.flattenObject;
2769
3058
  exports.invert = toMerged.invert;
2770
3059
  exports.isObjectLike = toMerged.isObjectLike;
@@ -2785,16 +3074,12 @@ exports.isLength = isWeakSet$1.isLength;
2785
3074
  exports.isNotNil = isWeakSet$1.isNotNil;
2786
3075
  exports.isNull = isWeakSet$1.isNull;
2787
3076
  exports.isUndefined = isWeakSet$1.isUndefined;
2788
- exports.capitalize = upperFirst.capitalize;
2789
- exports.constantCase = upperFirst.constantCase;
2790
- exports.deburr = upperFirst.deburr;
2791
- exports.escapeRegExp = upperFirst.escapeRegExp;
2792
- exports.lowerFirst = upperFirst.lowerFirst;
2793
- exports.pascalCase = upperFirst.pascalCase;
2794
- exports.unescape = upperFirst.unescape;
2795
- exports.upperFirst = upperFirst.upperFirst;
3077
+ exports.capitalize = upperFirst$1.capitalize;
3078
+ exports.constantCase = upperFirst$1.constantCase;
3079
+ exports.pascalCase = upperFirst$1.pascalCase;
2796
3080
  exports.invariant = util_index.invariant;
2797
3081
  exports.add = add;
3082
+ exports.after = after;
2798
3083
  exports.ary = ary;
2799
3084
  exports.assignIn = assignIn;
2800
3085
  exports.attempt = attempt;
@@ -2816,11 +3101,14 @@ exports.constant = constant;
2816
3101
  exports.curry = curry;
2817
3102
  exports.curryRight = curryRight;
2818
3103
  exports.debounce = debounce;
3104
+ exports.deburr = deburr;
2819
3105
  exports.defaultTo = defaultTo;
2820
3106
  exports.defaults = defaults;
2821
3107
  exports.defer = defer;
3108
+ exports.delay = delay;
2822
3109
  exports.difference = difference;
2823
3110
  exports.differenceBy = differenceBy;
3111
+ exports.differenceWith = differenceWith;
2824
3112
  exports.drop = drop;
2825
3113
  exports.dropRight = dropRight;
2826
3114
  exports.dropRightWhile = dropRightWhile;
@@ -2828,12 +3116,14 @@ exports.dropWhile = dropWhile;
2828
3116
  exports.each = forEach;
2829
3117
  exports.endsWith = endsWith;
2830
3118
  exports.escape = escape;
3119
+ exports.escapeRegExp = escapeRegExp;
2831
3120
  exports.every = every;
2832
3121
  exports.extend = assignIn;
2833
3122
  exports.fill = fill;
2834
3123
  exports.filter = filter;
2835
3124
  exports.find = find;
2836
3125
  exports.findIndex = findIndex;
3126
+ exports.findKey = findKey;
2837
3127
  exports.findLastIndex = findLastIndex;
2838
3128
  exports.first = head;
2839
3129
  exports.flatten = flatten;
@@ -2856,6 +3146,7 @@ exports.indexOf = indexOf;
2856
3146
  exports.intersection = intersection;
2857
3147
  exports.intersectionBy = intersectionBy;
2858
3148
  exports.invertBy = invertBy;
3149
+ exports.invoke = invoke;
2859
3150
  exports.isArguments = isArguments;
2860
3151
  exports.isArray = isArray;
2861
3152
  exports.isArrayBuffer = isArrayBuffer;
@@ -2887,10 +3178,15 @@ exports.isWeakSet = isWeakSet;
2887
3178
  exports.iteratee = iteratee;
2888
3179
  exports.join = join;
2889
3180
  exports.kebabCase = kebabCase;
3181
+ exports.keys = keys;
2890
3182
  exports.keysIn = keysIn;
2891
3183
  exports.last = last;
2892
3184
  exports.lastIndexOf = lastIndexOf;
2893
3185
  exports.lowerCase = lowerCase;
3186
+ exports.lowerFirst = lowerFirst;
3187
+ exports.lt = lt;
3188
+ exports.lte = lte;
3189
+ exports.map = map;
2894
3190
  exports.mapKeys = mapKeys;
2895
3191
  exports.mapValues = mapValues;
2896
3192
  exports.matches = matches;
@@ -2898,7 +3194,11 @@ exports.matchesProperty = matchesProperty;
2898
3194
  exports.max = max;
2899
3195
  exports.merge = merge;
2900
3196
  exports.mergeWith = mergeWith;
3197
+ exports.method = method;
2901
3198
  exports.min = min;
3199
+ exports.now = now;
3200
+ exports.nth = nth;
3201
+ exports.nthArg = nthArg;
2902
3202
  exports.omit = omit;
2903
3203
  exports.orderBy = orderBy;
2904
3204
  exports.pad = pad;
@@ -2907,7 +3207,11 @@ exports.padStart = padStart;
2907
3207
  exports.parseInt = parseInt;
2908
3208
  exports.pick = pick;
2909
3209
  exports.property = property;
3210
+ exports.propertyOf = propertyOf;
3211
+ exports.pull = pull;
2910
3212
  exports.random = random;
3213
+ exports.range = range;
3214
+ exports.rangeRight = rangeRight;
2911
3215
  exports.rearg = rearg;
2912
3216
  exports.repeat = repeat;
2913
3217
  exports.replace = replace;
@@ -2923,11 +3227,17 @@ exports.sortBy = sortBy;
2923
3227
  exports.spread = spread;
2924
3228
  exports.startCase = startCase;
2925
3229
  exports.startsWith = startsWith;
3230
+ exports.stubArray = stubArray;
3231
+ exports.stubFalse = stubFalse;
3232
+ exports.stubObject = stubObject;
3233
+ exports.stubString = stubString;
3234
+ exports.stubTrue = stubTrue;
2926
3235
  exports.sum = sum;
2927
3236
  exports.sumBy = sumBy;
2928
3237
  exports.tail = tail;
2929
3238
  exports.take = take;
2930
3239
  exports.takeRight = takeRight;
3240
+ exports.takeRightWhile = takeRightWhile;
2931
3241
  exports.template = template;
2932
3242
  exports.templateSettings = templateSettings;
2933
3243
  exports.throttle = throttle;
@@ -2937,21 +3247,24 @@ exports.toDefaulted = toDefaulted;
2937
3247
  exports.toFinite = toFinite;
2938
3248
  exports.toInteger = toInteger;
2939
3249
  exports.toLength = toLength;
3250
+ exports.toLower = toLower;
2940
3251
  exports.toNumber = toNumber;
2941
3252
  exports.toPath = toPath;
3253
+ exports.toPlainObject = toPlainObject;
2942
3254
  exports.toSafeInteger = toSafeInteger;
2943
3255
  exports.toString = toString;
2944
3256
  exports.toUpper = toUpper;
2945
3257
  exports.trim = trim;
2946
3258
  exports.trimEnd = trimEnd;
2947
3259
  exports.trimStart = trimStart;
3260
+ exports.unescape = unescape;
2948
3261
  exports.union = union;
2949
3262
  exports.uniq = uniq;
2950
3263
  exports.uniqBy = uniqBy;
2951
- exports.uniqueId = uniqueId;
2952
3264
  exports.unset = unset;
2953
3265
  exports.unzip = unzip;
2954
3266
  exports.upperCase = upperCase;
3267
+ exports.upperFirst = upperFirst;
2955
3268
  exports.without = without;
2956
3269
  exports.words = words;
2957
3270
  exports.zip = zip;