es-toolkit 1.19.0 → 1.20.0-dev.625

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 (70) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/_chunk/{curry-BmwJrK.js → rest-pUyjvl.js} +47 -46
  3. package/dist/_chunk/{zipWith-B-5AMf.js → zipWith-CDtN9Y.js} +11 -16
  4. package/dist/array/at.mjs +1 -1
  5. package/dist/array/index.js +7 -2
  6. package/dist/array/initial.d.mts +41 -13
  7. package/dist/array/initial.d.ts +41 -13
  8. package/dist/array/zip.mjs +8 -7
  9. package/dist/array/zipWith.mjs +2 -2
  10. package/dist/browser.global.js +1 -1
  11. package/dist/browser.global.js.map +1 -1
  12. package/dist/compat/array/drop.d.mts +19 -0
  13. package/dist/compat/array/drop.d.ts +19 -0
  14. package/dist/compat/array/drop.mjs +9 -0
  15. package/dist/compat/array/findLastIndex.mjs +8 -8
  16. package/dist/compat/array/some.d.mts +0 -1
  17. package/dist/compat/array/some.d.ts +0 -1
  18. package/dist/compat/function/curry.d.mts +48 -0
  19. package/dist/compat/function/curry.d.ts +48 -0
  20. package/dist/compat/function/curry.mjs +65 -0
  21. package/dist/compat/function/debounce.d.mts +73 -0
  22. package/dist/compat/function/debounce.d.ts +73 -0
  23. package/dist/compat/function/debounce.mjs +48 -0
  24. package/dist/compat/function/throttle.d.mts +52 -0
  25. package/dist/compat/function/throttle.d.ts +52 -0
  26. package/dist/compat/function/throttle.mjs +11 -0
  27. package/dist/compat/index.d.mts +8 -6
  28. package/dist/compat/index.d.ts +8 -6
  29. package/dist/compat/index.js +180 -28
  30. package/dist/compat/index.mjs +8 -6
  31. package/dist/compat/math/clamp.d.mts +32 -0
  32. package/dist/compat/math/clamp.d.ts +32 -0
  33. package/dist/compat/math/clamp.mjs +13 -0
  34. package/dist/compat/predicate/isNaN.d.mts +15 -0
  35. package/dist/compat/predicate/isNaN.d.ts +15 -0
  36. package/dist/compat/predicate/isNaN.mjs +5 -0
  37. package/dist/compat/predicate/isNumber.d.mts +20 -0
  38. package/dist/compat/predicate/isNumber.d.ts +20 -0
  39. package/dist/compat/predicate/isNumber.mjs +10 -0
  40. package/dist/compat/string/camelCase.d.mts +1 -1
  41. package/dist/compat/string/camelCase.d.ts +1 -1
  42. package/dist/compat/string/kebabCase.d.mts +2 -2
  43. package/dist/compat/string/kebabCase.d.ts +2 -2
  44. package/dist/compat/string/kebabCase.mjs +0 -1
  45. package/dist/compat/string/lowerCase.d.mts +2 -2
  46. package/dist/compat/string/lowerCase.d.ts +2 -2
  47. package/dist/compat/string/snakeCase.d.mts +2 -2
  48. package/dist/compat/string/snakeCase.d.ts +2 -2
  49. package/dist/compat/string/startCase.d.mts +2 -2
  50. package/dist/compat/string/startCase.d.ts +2 -2
  51. package/dist/compat/string/trim.d.mts +0 -1
  52. package/dist/compat/string/trim.d.ts +0 -1
  53. package/dist/compat/string/trimEnd.d.mts +0 -1
  54. package/dist/compat/string/trimEnd.d.ts +0 -1
  55. package/dist/compat/string/trimStart.d.mts +0 -1
  56. package/dist/compat/string/trimStart.d.ts +0 -1
  57. package/dist/compat/string/upperCase.d.mts +17 -0
  58. package/dist/compat/string/upperCase.d.ts +17 -0
  59. package/dist/compat/string/upperCase.mjs +9 -0
  60. package/dist/function/debounce.d.mts +30 -1
  61. package/dist/function/debounce.d.ts +30 -1
  62. package/dist/function/debounce.mjs +47 -12
  63. package/dist/function/index.js +55 -15
  64. package/dist/function/throttle.d.mts +18 -1
  65. package/dist/function/throttle.d.ts +18 -1
  66. package/dist/function/throttle.mjs +18 -8
  67. package/dist/index.js +17 -17
  68. package/dist/math/inRange.d.mts +23 -0
  69. package/dist/math/inRange.d.ts +23 -0
  70. package/package.json +1 -1
@@ -3,7 +3,6 @@ export { compact } from '../array/compact.js';
3
3
  export { countBy } from '../array/countBy.js';
4
4
  export { differenceBy } from '../array/differenceBy.js';
5
5
  export { differenceWith } from '../array/differenceWith.js';
6
- export { drop } from '../array/drop.js';
7
6
  export { dropRight } from '../array/dropRight.js';
8
7
  export { dropRightWhile } from '../array/dropRightWhile.js';
9
8
  export { dropWhile } from '../array/dropWhile.js';
@@ -51,17 +50,13 @@ export { AbortError } from '../error/AbortError.js';
51
50
  export { TimeoutError } from '../error/TimeoutError.js';
52
51
  export { before } from '../function/before.js';
53
52
  export { after } from '../function/after.js';
54
- export { debounce } from '../function/debounce.js';
55
53
  export { noop } from '../function/noop.js';
56
54
  export { once } from '../function/once.js';
57
- export { throttle } from '../function/throttle.js';
58
55
  export { negate } from '../function/negate.js';
59
56
  export { MemoizeCache, memoize } from '../function/memoize.js';
60
57
  export { unary } from '../function/unary.js';
61
58
  export { partial } from '../function/partial.js';
62
59
  export { partialRight } from '../function/partialRight.js';
63
- export { curry } from '../function/curry.js';
64
- export { clamp } from '../math/clamp.js';
65
60
  export { inRange } from '../math/inRange.js';
66
61
  export { mean } from '../math/mean.js';
67
62
  export { meanBy } from '../math/meanBy.js';
@@ -89,7 +84,6 @@ export { isPrimitive } from '../predicate/isPrimitive.js';
89
84
  export { delay } from '../promise/delay.js';
90
85
  export { withTimeout } from '../promise/withTimeout.js';
91
86
  export { timeout } from '../promise/timeout.js';
92
- export { upperCase } from '../string/upperCase.js';
93
87
  export { capitalize } from '../string/capitalize.js';
94
88
  export { pascalCase } from '../string/pascalCase.js';
95
89
  export { upperFirst } from '../string/upperFirst.js';
@@ -103,6 +97,7 @@ export { castArray } from './array/castArray.js';
103
97
  export { chunk } from './array/chunk.js';
104
98
  export { concat } from './array/concat.js';
105
99
  export { difference } from './array/difference.js';
100
+ export { drop } from './array/drop.js';
106
101
  export { fill } from './array/fill.js';
107
102
  export { find } from './array/find.js';
108
103
  export { findIndex } from './array/findIndex.js';
@@ -124,6 +119,9 @@ export { rest } from './function/rest.js';
124
119
  export { spread } from './function/spread.js';
125
120
  export { attempt } from './function/attempt.js';
126
121
  export { rearg } from './function/rearg.js';
122
+ export { curry } from './function/curry.js';
123
+ export { debounce } from './function/debounce.js';
124
+ export { throttle } from './function/throttle.js';
127
125
  export { get } from './object/get.js';
128
126
  export { set } from './object/set.js';
129
127
  export { pick } from './object/pick.js';
@@ -156,11 +154,14 @@ export { conforms } from './predicate/conforms.js';
156
154
  export { conformsTo } from './predicate/conformsTo.js';
157
155
  export { isInteger } from './predicate/isInteger.js';
158
156
  export { isSafeInteger } from './predicate/isSafeInteger.js';
157
+ export { isNumber } from './predicate/isNumber.js';
158
+ export { isNaN } from './predicate/isNaN.js';
159
159
  export { camelCase } from './string/camelCase.js';
160
160
  export { kebabCase } from './string/kebabCase.js';
161
161
  export { snakeCase } from './string/snakeCase.js';
162
162
  export { startCase } from './string/startCase.js';
163
163
  export { lowerCase } from './string/lowerCase.js';
164
+ export { upperCase } from './string/upperCase.js';
164
165
  export { startsWith } from './string/startsWith.js';
165
166
  export { endsWith } from './string/endsWith.js';
166
167
  export { padStart } from './string/padStart.js';
@@ -169,6 +170,7 @@ export { repeat } from './string/repeat.js';
169
170
  export { trim } from './string/trim.js';
170
171
  export { trimStart } from './string/trimStart.js';
171
172
  export { trimEnd } from './string/trimEnd.js';
173
+ export { clamp } from './math/clamp.js';
172
174
  export { max } from './math/max.js';
173
175
  export { min } from './math/min.js';
174
176
  export { ceil } from './math/ceil.js';
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const zipWith = require('../_chunk/zipWith-B-5AMf.js');
5
+ const zipWith = require('../_chunk/zipWith-CDtN9Y.js');
6
6
  const promise_index = require('../_chunk/index-BGZDR9.js');
7
- const curry = require('../_chunk/curry-BmwJrK.js');
7
+ const rest$1 = require('../_chunk/rest-pUyjvl.js');
8
8
  const range = require('../_chunk/range-BXlMmn.js');
9
9
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
10
10
  const toMerged = require('../_chunk/toMerged-Bzkqyz.js');
@@ -37,6 +37,14 @@ function difference(arr, ...values) {
37
37
  return zipWith.difference(arr1, arr2);
38
38
  }
39
39
 
40
+ function drop(collection, itemsCount) {
41
+ if (collection === null || collection === undefined) {
42
+ return [];
43
+ }
44
+ itemsCount = Math.max(itemsCount, 0);
45
+ return collection.slice(itemsCount);
46
+ }
47
+
40
48
  function fill(array, value, start = 0, end = array.length) {
41
49
  start = Math.floor(start);
42
50
  end = Math.floor(end);
@@ -430,30 +438,30 @@ function findIndex(source, doesMatch) {
430
438
  }
431
439
  }
432
440
 
433
- function findLastIndex(source, doesMatch, fromIndex = source.length - 1) {
441
+ function findLastIndex(arr, doesMatch, fromIndex = arr.length - 1) {
434
442
  if (fromIndex < 0) {
435
- fromIndex = Math.max(source.length + fromIndex, 0);
443
+ fromIndex = Math.max(arr.length + fromIndex, 0);
436
444
  }
437
445
  else {
438
- fromIndex = Math.min(fromIndex, source.length - 1);
446
+ fromIndex = Math.min(fromIndex, arr.length - 1);
439
447
  }
440
- source = source.slice(0, fromIndex + 1);
448
+ arr = arr.slice(0, fromIndex + 1);
441
449
  switch (typeof doesMatch) {
442
450
  case 'function': {
443
- return source.findLastIndex(doesMatch);
451
+ return arr.findLastIndex(doesMatch);
444
452
  }
445
453
  case 'object': {
446
454
  if (Array.isArray(doesMatch) && doesMatch.length === 2) {
447
455
  const key = doesMatch[0];
448
456
  const value = doesMatch[1];
449
- return source.findLastIndex(matchesProperty(key, value));
457
+ return arr.findLastIndex(matchesProperty(key, value));
450
458
  }
451
459
  else {
452
- return source.findLastIndex(matches(doesMatch));
460
+ return arr.findLastIndex(matches(doesMatch));
453
461
  }
454
462
  }
455
463
  case 'string': {
456
- return source.findLastIndex(property(doesMatch));
464
+ return arr.findLastIndex(property(doesMatch));
457
465
  }
458
466
  }
459
467
  }
@@ -721,7 +729,7 @@ function ary(func, n = func.length, guard) {
721
729
  if (Number.isNaN(n) || n < 0) {
722
730
  n = 0;
723
731
  }
724
- return curry.ary(func, n);
732
+ return rest$1.ary(func, n);
725
733
  }
726
734
 
727
735
  function bind(func, thisObj, ...partialArgs) {
@@ -781,7 +789,7 @@ function rest(func, start = func.length - 1) {
781
789
  if (Number.isNaN(start) || start < 0) {
782
790
  start = func.length - 1;
783
791
  }
784
- return curry.rest(func, start);
792
+ return rest$1.rest(func, start);
785
793
  }
786
794
 
787
795
  function spread(func, argsIndex = 0) {
@@ -819,6 +827,123 @@ function rearg(func, ...indices) {
819
827
  };
820
828
  }
821
829
 
830
+ function curry(func, arity = func.length, guard) {
831
+ arity = guard ? func.length : arity;
832
+ arity = Number.parseInt(arity, 10);
833
+ if (Number.isNaN(arity) || arity < 1) {
834
+ arity = 0;
835
+ }
836
+ const wrapper = function (...partials) {
837
+ const holders = replaceHolders(partials);
838
+ const length = partials.length - holders.length;
839
+ if (length < arity) {
840
+ return makeCurry(func, holders, arity - length, partials);
841
+ }
842
+ if (this instanceof wrapper) {
843
+ return new func(...partials);
844
+ }
845
+ return func.apply(this, partials);
846
+ };
847
+ wrapper.placeholder = curryPlaceholder;
848
+ return wrapper;
849
+ }
850
+ function makeCurry(func, holders, arity, partials) {
851
+ function wrapper(...args) {
852
+ const holdersCount = args.filter(item => item === curry.placeholder).length;
853
+ const length = args.length - holdersCount;
854
+ args = composeArgs(args, partials, holders);
855
+ if (length < arity) {
856
+ const newHolders = replaceHolders(args);
857
+ return makeCurry(func, newHolders, arity - length, args);
858
+ }
859
+ if (this instanceof wrapper) {
860
+ return new func(...args);
861
+ }
862
+ return func.apply(this, args);
863
+ }
864
+ wrapper.placeholder = curryPlaceholder;
865
+ return wrapper;
866
+ }
867
+ function replaceHolders(args) {
868
+ const result = [];
869
+ for (let i = 0; i < args.length; i++) {
870
+ if (args[i] === curry.placeholder) {
871
+ result.push(i);
872
+ }
873
+ }
874
+ return result;
875
+ }
876
+ function composeArgs(args, partials, holders) {
877
+ const result = [...partials];
878
+ const argsLength = args.length;
879
+ const holdersLength = holders.length;
880
+ let argsIndex = -1, leftIndex = partials.length, rangeLength = Math.max(argsLength - holdersLength, 0);
881
+ while (++argsIndex < holdersLength) {
882
+ if (argsIndex < argsLength) {
883
+ result[holders[argsIndex]] = args[argsIndex];
884
+ }
885
+ }
886
+ while (rangeLength--) {
887
+ result[leftIndex++] = args[argsIndex++];
888
+ }
889
+ return result;
890
+ }
891
+ const curryPlaceholder = Symbol('curry.placeholder');
892
+ curry.placeholder = curryPlaceholder;
893
+
894
+ function debounce(func, debounceMs = 0, options = {}) {
895
+ if (typeof options !== 'object') {
896
+ options = {};
897
+ }
898
+ const { signal, leading = false, trailing = true, maxWait } = options;
899
+ const edges = Array(2);
900
+ if (leading) {
901
+ edges[0] = 'leading';
902
+ }
903
+ if (trailing) {
904
+ edges[1] = 'trailing';
905
+ }
906
+ let result = undefined;
907
+ let pendingAt = null;
908
+ const _debounced = rest$1.debounce(function (...args) {
909
+ result = func.apply(this, args);
910
+ pendingAt = null;
911
+ }, debounceMs, { signal, edges });
912
+ const debounced = function (...args) {
913
+ if (maxWait != null) {
914
+ if (pendingAt === null) {
915
+ pendingAt = Date.now();
916
+ }
917
+ else {
918
+ if (Date.now() - pendingAt >= maxWait) {
919
+ result = func.apply(this, args);
920
+ pendingAt = Date.now();
921
+ _debounced.cancel();
922
+ _debounced.schedule();
923
+ return result;
924
+ }
925
+ }
926
+ }
927
+ _debounced.apply(this, args);
928
+ return result;
929
+ };
930
+ const flush = () => {
931
+ _debounced.flush();
932
+ return result;
933
+ };
934
+ debounced.cancel = _debounced.cancel;
935
+ debounced.flush = flush;
936
+ return debounced;
937
+ }
938
+
939
+ function throttle(func, throttleMs = 0, options = {}) {
940
+ if (typeof options !== 'object') {
941
+ options = {};
942
+ }
943
+ const { leading = true, trailing = true, signal } = options;
944
+ return debounce(func, throttleMs, { leading, trailing, signal, maxWait: throttleMs });
945
+ }
946
+
822
947
  function isNil(x) {
823
948
  return x == null;
824
949
  }
@@ -1085,7 +1210,7 @@ function mergeWithDeep(target, source, merge, stack) {
1085
1210
  }
1086
1211
 
1087
1212
  function merge(object, ...sources) {
1088
- return mergeWith(object, ...sources, curry.noop);
1213
+ return mergeWith(object, ...sources, rest$1.noop);
1089
1214
  }
1090
1215
 
1091
1216
  function isArrayLike(value) {
@@ -1175,6 +1300,17 @@ function isSafeInteger(value) {
1175
1300
  return Number.isSafeInteger(value);
1176
1301
  }
1177
1302
 
1303
+ function isNumber(value) {
1304
+ if (typeof value === 'object' && value != null && isWeakSet$1.getTag(value) === '[object Number]') {
1305
+ return true;
1306
+ }
1307
+ return typeof value === 'number';
1308
+ }
1309
+
1310
+ function isNaN(value) {
1311
+ return Number.isNaN(value);
1312
+ }
1313
+
1178
1314
  function toString(value) {
1179
1315
  if (value == null) {
1180
1316
  return '';
@@ -1216,6 +1352,10 @@ function lowerCase(str) {
1216
1352
  return string_index.lowerCase(normalizeForCase(str));
1217
1353
  }
1218
1354
 
1355
+ function upperCase(str) {
1356
+ return string_index.upperCase(normalizeForCase(str));
1357
+ }
1358
+
1219
1359
  function startsWith(str, target, position = 0) {
1220
1360
  return str.startsWith(target, position);
1221
1361
  }
@@ -1302,6 +1442,16 @@ function trimEnd(str, chars, guard) {
1302
1442
  }
1303
1443
  }
1304
1444
 
1445
+ function clamp(value, bound1, bound2) {
1446
+ if (Number.isNaN(bound1)) {
1447
+ bound1 = 0;
1448
+ }
1449
+ if (Number.isNaN(bound2)) {
1450
+ bound2 = 0;
1451
+ }
1452
+ return range.clamp(value, bound1, bound2);
1453
+ }
1454
+
1305
1455
  function max(items = []) {
1306
1456
  let maxElement = items[0];
1307
1457
  let max = undefined;
@@ -1368,7 +1518,6 @@ exports.compact = zipWith.compact;
1368
1518
  exports.countBy = zipWith.countBy;
1369
1519
  exports.differenceBy = zipWith.differenceBy;
1370
1520
  exports.differenceWith = zipWith.differenceWith;
1371
- exports.drop = zipWith.drop;
1372
1521
  exports.dropRight = zipWith.dropRight;
1373
1522
  exports.dropRightWhile = zipWith.dropRightWhile;
1374
1523
  exports.dropWhile = zipWith.dropWhile;
@@ -1418,19 +1567,15 @@ exports.TimeoutError = promise_index.TimeoutError;
1418
1567
  exports.delay = promise_index.delay;
1419
1568
  exports.timeout = promise_index.timeout;
1420
1569
  exports.withTimeout = promise_index.withTimeout;
1421
- exports.after = curry.after;
1422
- exports.before = curry.before;
1423
- exports.curry = curry.curry;
1424
- exports.debounce = curry.debounce;
1425
- exports.memoize = curry.memoize;
1426
- exports.negate = curry.negate;
1427
- exports.noop = curry.noop;
1428
- exports.once = curry.once;
1429
- exports.partial = curry.partial;
1430
- exports.partialRight = curry.partialRight;
1431
- exports.throttle = curry.throttle;
1432
- exports.unary = curry.unary;
1433
- exports.clamp = range.clamp;
1570
+ exports.after = rest$1.after;
1571
+ exports.before = rest$1.before;
1572
+ exports.memoize = rest$1.memoize;
1573
+ exports.negate = rest$1.negate;
1574
+ exports.noop = rest$1.noop;
1575
+ exports.once = rest$1.once;
1576
+ exports.partial = rest$1.partial;
1577
+ exports.partialRight = rest$1.partialRight;
1578
+ exports.unary = rest$1.unary;
1434
1579
  exports.inRange = range.inRange;
1435
1580
  exports.mean = range.mean;
1436
1581
  exports.meanBy = range.meanBy;
@@ -1464,7 +1609,6 @@ exports.lowerFirst = string_index.lowerFirst;
1464
1609
  exports.pad = string_index.pad;
1465
1610
  exports.pascalCase = string_index.pascalCase;
1466
1611
  exports.unescape = string_index.unescape;
1467
- exports.upperCase = string_index.upperCase;
1468
1612
  exports.upperFirst = string_index.upperFirst;
1469
1613
  exports.ary = ary;
1470
1614
  exports.attempt = attempt;
@@ -1474,10 +1618,14 @@ exports.camelCase = camelCase;
1474
1618
  exports.castArray = castArray;
1475
1619
  exports.ceil = ceil;
1476
1620
  exports.chunk = chunk;
1621
+ exports.clamp = clamp;
1477
1622
  exports.concat = concat;
1478
1623
  exports.conforms = conforms;
1479
1624
  exports.conformsTo = conformsTo;
1625
+ exports.curry = curry;
1626
+ exports.debounce = debounce;
1480
1627
  exports.difference = difference;
1628
+ exports.drop = drop;
1481
1629
  exports.endsWith = endsWith;
1482
1630
  exports.fill = fill;
1483
1631
  exports.find = find;
@@ -1497,6 +1645,8 @@ exports.isArrayLike = isArrayLike;
1497
1645
  exports.isBoolean = isBoolean;
1498
1646
  exports.isInteger = isInteger;
1499
1647
  exports.isMatch = isMatch;
1648
+ exports.isNaN = isNaN;
1649
+ exports.isNumber = isNumber;
1500
1650
  exports.isObject = isObject;
1501
1651
  exports.isPlainObject = isPlainObject;
1502
1652
  exports.isRegExp = isRegExp;
@@ -1536,10 +1686,12 @@ exports.sortBy = sortBy;
1536
1686
  exports.spread = spread;
1537
1687
  exports.startCase = startCase;
1538
1688
  exports.startsWith = startsWith;
1689
+ exports.throttle = throttle;
1539
1690
  exports.toPath = toPath;
1540
1691
  exports.toString = toString;
1541
1692
  exports.trim = trim;
1542
1693
  exports.trimEnd = trimEnd;
1543
1694
  exports.trimStart = trimStart;
1544
1695
  exports.unset = unset;
1696
+ exports.upperCase = upperCase;
1545
1697
  exports.zipObjectDeep = zipObjectDeep;
@@ -3,7 +3,6 @@ export { compact } from '../array/compact.mjs';
3
3
  export { countBy } from '../array/countBy.mjs';
4
4
  export { differenceBy } from '../array/differenceBy.mjs';
5
5
  export { differenceWith } from '../array/differenceWith.mjs';
6
- export { drop } from '../array/drop.mjs';
7
6
  export { dropRight } from '../array/dropRight.mjs';
8
7
  export { dropRightWhile } from '../array/dropRightWhile.mjs';
9
8
  export { dropWhile } from '../array/dropWhile.mjs';
@@ -51,17 +50,13 @@ export { AbortError } from '../error/AbortError.mjs';
51
50
  export { TimeoutError } from '../error/TimeoutError.mjs';
52
51
  export { before } from '../function/before.mjs';
53
52
  export { after } from '../function/after.mjs';
54
- export { debounce } from '../function/debounce.mjs';
55
53
  export { noop } from '../function/noop.mjs';
56
54
  export { once } from '../function/once.mjs';
57
- export { throttle } from '../function/throttle.mjs';
58
55
  export { negate } from '../function/negate.mjs';
59
56
  export { memoize } from '../function/memoize.mjs';
60
57
  export { unary } from '../function/unary.mjs';
61
58
  export { partial } from '../function/partial.mjs';
62
59
  export { partialRight } from '../function/partialRight.mjs';
63
- export { curry } from '../function/curry.mjs';
64
- export { clamp } from '../math/clamp.mjs';
65
60
  export { inRange } from '../math/inRange.mjs';
66
61
  export { mean } from '../math/mean.mjs';
67
62
  export { meanBy } from '../math/meanBy.mjs';
@@ -91,7 +86,6 @@ export { delay } from '../promise/delay.mjs';
91
86
  export { withTimeout } from '../promise/withTimeout.mjs';
92
87
  export { timeout } from '../promise/timeout.mjs';
93
88
  export { capitalize } from '../string/capitalize.mjs';
94
- export { upperCase } from '../string/upperCase.mjs';
95
89
  export { pascalCase } from '../string/pascalCase.mjs';
96
90
  export { upperFirst } from '../string/upperFirst.mjs';
97
91
  export { lowerFirst } from '../string/lowerFirst.mjs';
@@ -104,6 +98,7 @@ export { castArray } from './array/castArray.mjs';
104
98
  export { chunk } from './array/chunk.mjs';
105
99
  export { concat } from './array/concat.mjs';
106
100
  export { difference } from './array/difference.mjs';
101
+ export { drop } from './array/drop.mjs';
107
102
  export { fill } from './array/fill.mjs';
108
103
  export { find } from './array/find.mjs';
109
104
  export { findIndex } from './array/findIndex.mjs';
@@ -125,6 +120,9 @@ export { rest } from './function/rest.mjs';
125
120
  export { spread } from './function/spread.mjs';
126
121
  export { attempt } from './function/attempt.mjs';
127
122
  export { rearg } from './function/rearg.mjs';
123
+ export { curry } from './function/curry.mjs';
124
+ export { debounce } from './function/debounce.mjs';
125
+ export { throttle } from './function/throttle.mjs';
128
126
  export { get } from './object/get.mjs';
129
127
  export { set } from './object/set.mjs';
130
128
  export { pick } from './object/pick.mjs';
@@ -156,11 +154,14 @@ export { conforms } from './predicate/conforms.mjs';
156
154
  export { conformsTo } from './predicate/conformsTo.mjs';
157
155
  export { isInteger } from './predicate/isInteger.mjs';
158
156
  export { isSafeInteger } from './predicate/isSafeInteger.mjs';
157
+ export { isNumber } from './predicate/isNumber.mjs';
158
+ export { isNaN } from './predicate/isNaN.mjs';
159
159
  export { camelCase } from './string/camelCase.mjs';
160
160
  export { kebabCase } from './string/kebabCase.mjs';
161
161
  export { snakeCase } from './string/snakeCase.mjs';
162
162
  export { startCase } from './string/startCase.mjs';
163
163
  export { lowerCase } from './string/lowerCase.mjs';
164
+ export { upperCase } from './string/upperCase.mjs';
164
165
  export { startsWith } from './string/startsWith.mjs';
165
166
  export { endsWith } from './string/endsWith.mjs';
166
167
  export { padStart } from './string/padStart.mjs';
@@ -169,6 +170,7 @@ export { repeat } from './string/repeat.mjs';
169
170
  export { trim } from './string/trim.mjs';
170
171
  export { trimStart } from './string/trimStart.mjs';
171
172
  export { trimEnd } from './string/trimEnd.mjs';
173
+ export { clamp } from './math/clamp.mjs';
172
174
  export { max } from './math/max.mjs';
173
175
  export { min } from './math/min.mjs';
174
176
  export { ceil } from './math/ceil.mjs';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Clamps a number within the inclusive upper bound.
3
+ *
4
+ * This function takes a number and a maximum bound, and returns the number clamped within the specified upper bound.
5
+ * If only one bound is provided, it returns the minimum of the value and the bound.
6
+ *
7
+ * @param {number} value - The number to clamp.
8
+ * @param {number} maximum - The maximum bound to clamp the number.
9
+ * @returns {number} The clamped number within the specified upper bound.
10
+ *
11
+ * @example
12
+ * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
13
+ */
14
+ declare function clamp(value: number, maximum: number): number;
15
+ /**
16
+ * Clamps a number within the inclusive lower and upper bounds.
17
+ *
18
+ * This function takes a number and two bounds, and returns the number clamped within the specified bounds.
19
+ *
20
+ * @param {number} value - The number to clamp.
21
+ * @param {number} minimum - The minimum bound to clamp the number.
22
+ * @param {number} maximum - The maximum bound to clamp the number.
23
+ * @returns {number} The clamped number within the specified bounds.
24
+ *
25
+ * @example
26
+ * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
27
+ * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
28
+ * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
29
+ */
30
+ declare function clamp(value: number, minimum: number, maximum: number): number;
31
+
32
+ export { clamp };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Clamps a number within the inclusive upper bound.
3
+ *
4
+ * This function takes a number and a maximum bound, and returns the number clamped within the specified upper bound.
5
+ * If only one bound is provided, it returns the minimum of the value and the bound.
6
+ *
7
+ * @param {number} value - The number to clamp.
8
+ * @param {number} maximum - The maximum bound to clamp the number.
9
+ * @returns {number} The clamped number within the specified upper bound.
10
+ *
11
+ * @example
12
+ * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
13
+ */
14
+ declare function clamp(value: number, maximum: number): number;
15
+ /**
16
+ * Clamps a number within the inclusive lower and upper bounds.
17
+ *
18
+ * This function takes a number and two bounds, and returns the number clamped within the specified bounds.
19
+ *
20
+ * @param {number} value - The number to clamp.
21
+ * @param {number} minimum - The minimum bound to clamp the number.
22
+ * @param {number} maximum - The maximum bound to clamp the number.
23
+ * @returns {number} The clamped number within the specified bounds.
24
+ *
25
+ * @example
26
+ * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
27
+ * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
28
+ * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
29
+ */
30
+ declare function clamp(value: number, minimum: number, maximum: number): number;
31
+
32
+ export { clamp };
@@ -0,0 +1,13 @@
1
+ import { clamp as clamp$1 } from '../../math/clamp.mjs';
2
+
3
+ function clamp(value, bound1, bound2) {
4
+ if (Number.isNaN(bound1)) {
5
+ bound1 = 0;
6
+ }
7
+ if (Number.isNaN(bound2)) {
8
+ bound2 = 0;
9
+ }
10
+ return clamp$1(value, bound1, bound2);
11
+ }
12
+
13
+ export { clamp };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Checks if the value is NaN.
3
+ *
4
+ * @param {unknown} value - The value to check.
5
+ * @returns {value is typeof NaN} `true` if the value is NaN, `false` otherwise.
6
+ *
7
+ * @example
8
+ * isNaN(NaN); // true
9
+ * isNaN(0); // false
10
+ * isNaN('NaN'); // false
11
+ * isNaN(undefined); // false
12
+ */
13
+ declare function isNaN(value: unknown): value is typeof NaN;
14
+
15
+ export { isNaN };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Checks if the value is NaN.
3
+ *
4
+ * @param {unknown} value - The value to check.
5
+ * @returns {value is typeof NaN} `true` if the value is NaN, `false` otherwise.
6
+ *
7
+ * @example
8
+ * isNaN(NaN); // true
9
+ * isNaN(0); // false
10
+ * isNaN('NaN'); // false
11
+ * isNaN(undefined); // false
12
+ */
13
+ declare function isNaN(value: unknown): value is typeof NaN;
14
+
15
+ export { isNaN };
@@ -0,0 +1,5 @@
1
+ function isNaN(value) {
2
+ return Number.isNaN(value);
3
+ }
4
+
5
+ export { isNaN };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Checks if a given value is a number.
3
+ *
4
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`.
5
+ *
6
+ * @param {unknown} value The value to check if it is a number.
7
+ * @returns {value is number} Returns `true` if `value` is a number, else `false`.
8
+ *
9
+ * @example
10
+ * const value1 = 123;
11
+ * const value2 = 'abc';
12
+ * const value3 = true;
13
+ *
14
+ * console.log(isNumber(value1)); // true
15
+ * console.log(isNumber(value2)); // false
16
+ * console.log(isNumber(value3)); // false
17
+ */
18
+ declare function isNumber(value?: unknown): value is number;
19
+
20
+ export { isNumber };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Checks if a given value is a number.
3
+ *
4
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`.
5
+ *
6
+ * @param {unknown} value The value to check if it is a number.
7
+ * @returns {value is number} Returns `true` if `value` is a number, else `false`.
8
+ *
9
+ * @example
10
+ * const value1 = 123;
11
+ * const value2 = 'abc';
12
+ * const value3 = true;
13
+ *
14
+ * console.log(isNumber(value1)); // true
15
+ * console.log(isNumber(value2)); // false
16
+ * console.log(isNumber(value3)); // false
17
+ */
18
+ declare function isNumber(value?: unknown): value is number;
19
+
20
+ export { isNumber };
@@ -0,0 +1,10 @@
1
+ import { getTag } from '../_internal/getTag.mjs';
2
+
3
+ function isNumber(value) {
4
+ if (typeof value === 'object' && value != null && getTag(value) === '[object Number]') {
5
+ return true;
6
+ }
7
+ return typeof value === 'number';
8
+ }
9
+
10
+ export { isNumber };
@@ -13,6 +13,6 @@
13
13
  * const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'
14
14
  * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'
15
15
  */
16
- declare function camelCase(str: string | object): string;
16
+ declare function camelCase(str?: string | object): string;
17
17
 
18
18
  export { camelCase };