es-toolkit 1.18.0 → 1.19.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 (157) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/_chunk/{rest-CXt9w3.js → curry-BmwJrK.js} +21 -0
  3. package/dist/_chunk/{isWeakSet-CogETi.js → isWeakSet-E_VMwB.js} +9 -3
  4. package/dist/_chunk/range-BXlMmn.js +68 -0
  5. package/dist/_chunk/{toMerged-DN1PPP.js → toMerged-Bzkqyz.js} +28 -46
  6. package/dist/_chunk/{zipWith-CYaH1Y.js → zipWith-B-5AMf.js} +1 -1
  7. package/dist/array/forEachRight.d.mts +23 -0
  8. package/dist/array/forEachRight.d.ts +23 -0
  9. package/dist/array/groupBy.mjs +1 -1
  10. package/dist/array/index.js +1 -1
  11. package/dist/array/orderBy.d.mts +1 -1
  12. package/dist/array/orderBy.d.ts +1 -1
  13. package/dist/array/sortBy.d.mts +1 -1
  14. package/dist/array/sortBy.d.ts +1 -1
  15. package/dist/array/unzip.d.mts +1 -1
  16. package/dist/array/unzip.d.ts +1 -1
  17. package/dist/array/zipObject.d.mts +1 -1
  18. package/dist/array/zipObject.d.ts +1 -1
  19. package/dist/browser.global.js +1 -1
  20. package/dist/browser.global.js.map +1 -1
  21. package/dist/compat/_internal/decimalAdjust.mjs +19 -0
  22. package/dist/compat/_internal/isDeepKey.mjs +1 -3
  23. package/dist/compat/_internal/normalizeForCase.mjs +5 -4
  24. package/dist/compat/_internal/toKey.mjs +2 -7
  25. package/dist/compat/array/flatten.d.mts +1 -1
  26. package/dist/compat/array/flatten.d.ts +1 -1
  27. package/dist/compat/array/flattenDepth.d.mts +1 -1
  28. package/dist/compat/array/flattenDepth.d.ts +1 -1
  29. package/dist/compat/array/indexOf.d.mts +1 -1
  30. package/dist/compat/array/indexOf.d.ts +1 -1
  31. package/dist/compat/array/orderBy.d.mts +1 -1
  32. package/dist/compat/array/orderBy.d.ts +1 -1
  33. package/dist/compat/array/orderBy.mjs +1 -1
  34. package/dist/compat/array/size.d.mts +1 -1
  35. package/dist/compat/array/size.d.ts +1 -1
  36. package/dist/compat/array/sortBy.d.mts +1 -1
  37. package/dist/compat/array/sortBy.d.ts +1 -1
  38. package/dist/compat/array/zipObjectDeep.d.mts +1 -1
  39. package/dist/compat/array/zipObjectDeep.d.ts +1 -1
  40. package/dist/compat/index.d.mts +20 -7
  41. package/dist/compat/index.d.ts +20 -7
  42. package/dist/compat/index.js +459 -137
  43. package/dist/compat/index.mjs +20 -7
  44. package/dist/compat/math/ceil.d.mts +15 -0
  45. package/dist/compat/math/ceil.d.ts +15 -0
  46. package/dist/compat/math/ceil.mjs +7 -0
  47. package/dist/compat/math/floor.d.mts +15 -0
  48. package/dist/compat/math/floor.d.ts +15 -0
  49. package/dist/compat/math/floor.mjs +7 -0
  50. package/dist/compat/math/round.d.mts +15 -0
  51. package/dist/compat/math/round.d.ts +15 -0
  52. package/dist/compat/math/round.mjs +7 -0
  53. package/dist/compat/object/fromPairs.d.mts +2 -2
  54. package/dist/compat/object/fromPairs.d.ts +2 -2
  55. package/dist/compat/object/get.d.mts +12 -12
  56. package/dist/compat/object/get.d.ts +12 -12
  57. package/dist/compat/object/get.mjs +54 -17
  58. package/dist/compat/object/has.mjs +1 -1
  59. package/dist/compat/object/mergeWith.mjs +14 -2
  60. package/dist/compat/object/omit.d.mts +34 -0
  61. package/dist/compat/object/omit.d.ts +34 -0
  62. package/dist/compat/object/omit.mjs +33 -0
  63. package/dist/compat/object/pick.d.mts +47 -0
  64. package/dist/compat/object/pick.d.ts +47 -0
  65. package/dist/compat/object/pick.mjs +38 -0
  66. package/dist/compat/object/set.mjs +1 -1
  67. package/dist/compat/object/unset.d.mts +20 -0
  68. package/dist/compat/object/unset.d.ts +20 -0
  69. package/dist/compat/object/unset.mjs +68 -0
  70. package/dist/compat/predicate/isInteger.d.mts +17 -0
  71. package/dist/compat/predicate/isInteger.d.ts +17 -0
  72. package/dist/compat/predicate/isInteger.mjs +5 -0
  73. package/dist/compat/predicate/isMatch.mjs +44 -4
  74. package/dist/compat/predicate/isNil.mjs +5 -0
  75. package/dist/compat/predicate/isObject.d.mts +4 -4
  76. package/dist/compat/predicate/isObject.d.ts +4 -4
  77. package/dist/compat/predicate/isSafeInteger.d.mts +20 -0
  78. package/dist/compat/predicate/isSafeInteger.d.ts +20 -0
  79. package/dist/compat/predicate/isSafeInteger.mjs +5 -0
  80. package/dist/compat/predicate/matchesProperty.mjs +12 -1
  81. package/dist/compat/string/kebabCase.d.mts +17 -0
  82. package/dist/compat/string/kebabCase.d.ts +17 -0
  83. package/dist/compat/string/kebabCase.mjs +9 -0
  84. package/dist/compat/string/lowerCase.d.mts +17 -0
  85. package/dist/compat/string/lowerCase.d.ts +17 -0
  86. package/dist/compat/string/lowerCase.mjs +8 -0
  87. package/dist/compat/string/snakeCase.d.mts +17 -0
  88. package/dist/compat/string/snakeCase.d.ts +17 -0
  89. package/dist/compat/string/snakeCase.mjs +8 -0
  90. package/dist/compat/string/startCase.d.mts +16 -0
  91. package/dist/compat/string/startCase.d.ts +16 -0
  92. package/dist/compat/string/startCase.mjs +8 -0
  93. package/dist/compat/string/trim.d.mts +16 -0
  94. package/dist/compat/string/trim.d.ts +16 -0
  95. package/dist/compat/string/trim.mjs +25 -0
  96. package/dist/compat/string/trimEnd.d.mts +17 -0
  97. package/dist/compat/string/trimEnd.d.ts +17 -0
  98. package/dist/compat/string/trimEnd.mjs +25 -0
  99. package/dist/compat/string/trimStart.d.mts +17 -0
  100. package/dist/compat/string/trimStart.d.ts +17 -0
  101. package/dist/compat/string/trimStart.mjs +25 -0
  102. package/dist/compat/util/toPath.d.mts +20 -0
  103. package/dist/compat/util/toPath.d.ts +20 -0
  104. package/dist/compat/util/toPath.mjs +37 -0
  105. package/dist/compat/util/toString.d.mts +19 -0
  106. package/dist/compat/util/toString.d.ts +19 -0
  107. package/dist/compat/util/toString.mjs +15 -0
  108. package/dist/function/curry.d.mts +127 -0
  109. package/dist/function/curry.d.ts +127 -0
  110. package/dist/function/curry.mjs +21 -0
  111. package/dist/function/index.d.mts +1 -0
  112. package/dist/function/index.d.ts +1 -0
  113. package/dist/function/index.js +15 -14
  114. package/dist/function/index.mjs +1 -0
  115. package/dist/index.d.mts +6 -0
  116. package/dist/index.d.ts +6 -0
  117. package/dist/index.js +40 -33
  118. package/dist/index.mjs +6 -0
  119. package/dist/math/index.js +8 -66
  120. package/dist/object/clone.mjs +28 -25
  121. package/dist/object/index.js +19 -3
  122. package/dist/object/pick.d.mts +1 -1
  123. package/dist/object/pick.d.ts +1 -1
  124. package/dist/predicate/index.d.mts +1 -0
  125. package/dist/predicate/index.d.ts +1 -0
  126. package/dist/predicate/index.js +6 -5
  127. package/dist/predicate/index.mjs +1 -0
  128. package/dist/predicate/isDate.d.mts +16 -0
  129. package/dist/predicate/isDate.d.ts +16 -0
  130. package/dist/predicate/isDate.mjs +5 -0
  131. package/dist/predicate/isNotNil.mjs +1 -1
  132. package/dist/string/capitalize.d.mts +1 -0
  133. package/dist/string/capitalize.d.ts +1 -0
  134. package/dist/string/index.d.mts +4 -0
  135. package/dist/string/index.d.ts +4 -0
  136. package/dist/string/index.js +65 -0
  137. package/dist/string/index.mjs +4 -0
  138. package/dist/string/startCase.d.mts +1 -1
  139. package/dist/string/startCase.d.ts +1 -1
  140. package/dist/string/trim.d.mts +15 -0
  141. package/dist/string/trim.d.ts +15 -0
  142. package/dist/string/trim.mjs +11 -0
  143. package/dist/string/trimEnd.d.mts +16 -0
  144. package/dist/string/trimEnd.d.ts +16 -0
  145. package/dist/string/trimEnd.mjs +22 -0
  146. package/dist/string/trimStart.d.mts +16 -0
  147. package/dist/string/trimStart.d.ts +16 -0
  148. package/dist/string/trimStart.mjs +22 -0
  149. package/dist/string/upperCase.d.mts +17 -0
  150. package/dist/string/upperCase.d.ts +17 -0
  151. package/dist/string/upperCase.mjs +15 -0
  152. package/package.json +1 -1
  153. package/dist/compat/_internal/isArrayMatch.mjs +0 -24
  154. package/dist/compat/_internal/isMapMatch.mjs +0 -18
  155. package/dist/compat/_internal/isSetMatch.mjs +0 -13
  156. package/dist/compat/_internal/toPath.mjs +0 -40
  157. package/dist/_chunk/{isTypedArray-Dsrnb1.js → isPlainObject-BIekvL.js} +8 -8
@@ -11,4 +11,5 @@ export { unary } from './unary.js';
11
11
  export { partial } from './partial.js';
12
12
  export { partialRight } from './partialRight.js';
13
13
  export { rest } from './rest.js';
14
+ export { curry } from './curry.js';
14
15
  export { spread } from './spread.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const rest = require('../_chunk/rest-CXt9w3.js');
5
+ const curry = require('../_chunk/curry-BmwJrK.js');
6
6
 
7
7
  function spread(func) {
8
8
  return function (argsArr) {
@@ -10,17 +10,18 @@ function spread(func) {
10
10
  };
11
11
  }
12
12
 
13
- exports.after = rest.after;
14
- exports.ary = rest.ary;
15
- exports.before = rest.before;
16
- exports.debounce = rest.debounce;
17
- exports.memoize = rest.memoize;
18
- exports.negate = rest.negate;
19
- exports.noop = rest.noop;
20
- exports.once = rest.once;
21
- exports.partial = rest.partial;
22
- exports.partialRight = rest.partialRight;
23
- exports.rest = rest.rest;
24
- exports.throttle = rest.throttle;
25
- exports.unary = rest.unary;
13
+ exports.after = curry.after;
14
+ exports.ary = curry.ary;
15
+ exports.before = curry.before;
16
+ exports.curry = curry.curry;
17
+ exports.debounce = curry.debounce;
18
+ exports.memoize = curry.memoize;
19
+ exports.negate = curry.negate;
20
+ exports.noop = curry.noop;
21
+ exports.once = curry.once;
22
+ exports.partial = curry.partial;
23
+ exports.partialRight = curry.partialRight;
24
+ exports.rest = curry.rest;
25
+ exports.throttle = curry.throttle;
26
+ exports.unary = curry.unary;
26
27
  exports.spread = spread;
@@ -11,4 +11,5 @@ export { unary } from './unary.mjs';
11
11
  export { partial } from './partial.mjs';
12
12
  export { partialRight } from './partialRight.mjs';
13
13
  export { rest } from './rest.mjs';
14
+ export { curry } from './curry.mjs';
14
15
  export { spread } from './spread.mjs';
package/dist/index.d.mts CHANGED
@@ -69,6 +69,7 @@ export { unary } from './function/unary.mjs';
69
69
  export { partial } from './function/partial.mjs';
70
70
  export { partialRight } from './function/partialRight.mjs';
71
71
  export { rest } from './function/rest.mjs';
72
+ export { curry } from './function/curry.mjs';
72
73
  export { spread } from './function/spread.mjs';
73
74
  export { clamp } from './math/clamp.mjs';
74
75
  export { inRange } from './math/inRange.mjs';
@@ -93,6 +94,7 @@ export { cloneDeep } from './object/cloneDeep.mjs';
93
94
  export { merge } from './object/merge.mjs';
94
95
  export { toMerged } from './object/toMerged.mjs';
95
96
  export { mergeWith } from './object/mergeWith.mjs';
97
+ export { isDate } from './predicate/isDate.mjs';
96
98
  export { isEqual } from './predicate/isEqual.mjs';
97
99
  export { isNil } from './predicate/isNil.mjs';
98
100
  export { isNotNil } from './predicate/isNotNil.mjs';
@@ -115,10 +117,14 @@ export { timeout } from './promise/timeout.mjs';
115
117
  export { camelCase } from './string/camelCase.mjs';
116
118
  export { snakeCase } from './string/snakeCase.mjs';
117
119
  export { kebabCase } from './string/kebabCase.mjs';
120
+ export { upperCase } from './string/upperCase.mjs';
118
121
  export { lowerCase } from './string/lowerCase.mjs';
119
122
  export { startCase } from './string/startCase.mjs';
120
123
  export { capitalize } from './string/capitalize.mjs';
121
124
  export { pascalCase } from './string/pascalCase.mjs';
125
+ export { trim } from './string/trim.mjs';
126
+ export { trimStart } from './string/trimStart.mjs';
127
+ export { trimEnd } from './string/trimEnd.mjs';
122
128
  export { upperFirst } from './string/upperFirst.mjs';
123
129
  export { lowerFirst } from './string/lowerFirst.mjs';
124
130
  export { deburr } from './string/deburr.mjs';
package/dist/index.d.ts CHANGED
@@ -69,6 +69,7 @@ export { unary } from './function/unary.js';
69
69
  export { partial } from './function/partial.js';
70
70
  export { partialRight } from './function/partialRight.js';
71
71
  export { rest } from './function/rest.js';
72
+ export { curry } from './function/curry.js';
72
73
  export { spread } from './function/spread.js';
73
74
  export { clamp } from './math/clamp.js';
74
75
  export { inRange } from './math/inRange.js';
@@ -93,6 +94,7 @@ export { cloneDeep } from './object/cloneDeep.js';
93
94
  export { merge } from './object/merge.js';
94
95
  export { toMerged } from './object/toMerged.js';
95
96
  export { mergeWith } from './object/mergeWith.js';
97
+ export { isDate } from './predicate/isDate.js';
96
98
  export { isEqual } from './predicate/isEqual.js';
97
99
  export { isNil } from './predicate/isNil.js';
98
100
  export { isNotNil } from './predicate/isNotNil.js';
@@ -115,10 +117,14 @@ export { timeout } from './promise/timeout.js';
115
117
  export { camelCase } from './string/camelCase.js';
116
118
  export { snakeCase } from './string/snakeCase.js';
117
119
  export { kebabCase } from './string/kebabCase.js';
120
+ export { upperCase } from './string/upperCase.js';
118
121
  export { lowerCase } from './string/lowerCase.js';
119
122
  export { startCase } from './string/startCase.js';
120
123
  export { capitalize } from './string/capitalize.js';
121
124
  export { pascalCase } from './string/pascalCase.js';
125
+ export { trim } from './string/trim.js';
126
+ export { trimStart } from './string/trimStart.js';
127
+ export { trimEnd } from './string/trimEnd.js';
122
128
  export { upperFirst } from './string/upperFirst.js';
123
129
  export { lowerFirst } from './string/lowerFirst.js';
124
130
  export { deburr } from './string/deburr.js';
package/dist/index.js CHANGED
@@ -2,17 +2,18 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const zipWith = require('./_chunk/zipWith-CYaH1Y.js');
5
+ const zipWith = require('./_chunk/zipWith-B-5AMf.js');
6
6
  const array_index = require('./array/index.js');
7
7
  const promise_index = require('./_chunk/index-BGZDR9.js');
8
- const rest = require('./_chunk/rest-CXt9w3.js');
8
+ const curry = require('./_chunk/curry-BmwJrK.js');
9
9
  const function_index = require('./function/index.js');
10
- const math_index = require('./math/index.js');
10
+ const range = require('./_chunk/range-BXlMmn.js');
11
11
  const randomInt = require('./_chunk/randomInt-CF7bZK.js');
12
- const toMerged = require('./_chunk/toMerged-DN1PPP.js');
12
+ const math_index = require('./math/index.js');
13
13
  const object_index = require('./object/index.js');
14
- const isWeakSet = require('./_chunk/isWeakSet-CogETi.js');
15
- const isTypedArray = require('./_chunk/isTypedArray-Dsrnb1.js');
14
+ const toMerged = require('./_chunk/toMerged-Bzkqyz.js');
15
+ const isWeakSet = require('./_chunk/isWeakSet-E_VMwB.js');
16
+ const isPlainObject = require('./_chunk/isPlainObject-BIekvL.js');
16
17
  const predicate_index = require('./predicate/index.js');
17
18
  const string_index = require('./string/index.js');
18
19
 
@@ -79,30 +80,34 @@ exports.TimeoutError = promise_index.TimeoutError;
79
80
  exports.delay = promise_index.delay;
80
81
  exports.timeout = promise_index.timeout;
81
82
  exports.withTimeout = promise_index.withTimeout;
82
- exports.after = rest.after;
83
- exports.ary = rest.ary;
84
- exports.before = rest.before;
85
- exports.debounce = rest.debounce;
86
- exports.memoize = rest.memoize;
87
- exports.negate = rest.negate;
88
- exports.noop = rest.noop;
89
- exports.once = rest.once;
90
- exports.partial = rest.partial;
91
- exports.partialRight = rest.partialRight;
92
- exports.rest = rest.rest;
93
- exports.throttle = rest.throttle;
94
- exports.unary = rest.unary;
83
+ exports.after = curry.after;
84
+ exports.ary = curry.ary;
85
+ exports.before = curry.before;
86
+ exports.curry = curry.curry;
87
+ exports.debounce = curry.debounce;
88
+ exports.memoize = curry.memoize;
89
+ exports.negate = curry.negate;
90
+ exports.noop = curry.noop;
91
+ exports.once = curry.once;
92
+ exports.partial = curry.partial;
93
+ exports.partialRight = curry.partialRight;
94
+ exports.rest = curry.rest;
95
+ exports.throttle = curry.throttle;
96
+ exports.unary = curry.unary;
95
97
  exports.spread = function_index.spread;
96
- exports.clamp = math_index.clamp;
97
- exports.inRange = math_index.inRange;
98
- exports.mean = math_index.mean;
99
- exports.meanBy = math_index.meanBy;
100
- exports.range = math_index.range;
101
- exports.round = math_index.round;
102
- exports.sum = math_index.sum;
103
- exports.sumBy = math_index.sumBy;
98
+ exports.clamp = range.clamp;
99
+ exports.inRange = range.inRange;
100
+ exports.mean = range.mean;
101
+ exports.meanBy = range.meanBy;
102
+ exports.range = range.range;
103
+ exports.sum = range.sum;
104
+ exports.sumBy = range.sumBy;
104
105
  exports.random = randomInt.random;
105
106
  exports.randomInt = randomInt.randomInt;
107
+ exports.round = math_index.round;
108
+ exports.mergeWith = object_index.mergeWith;
109
+ exports.omit = object_index.omit;
110
+ exports.pick = object_index.pick;
106
111
  exports.clone = toMerged.clone;
107
112
  exports.cloneDeep = toMerged.cloneDeep;
108
113
  exports.flattenObject = toMerged.flattenObject;
@@ -110,12 +115,10 @@ exports.invert = toMerged.invert;
110
115
  exports.mapKeys = toMerged.mapKeys;
111
116
  exports.mapValues = toMerged.mapValues;
112
117
  exports.merge = toMerged.merge;
113
- exports.omit = toMerged.omit;
114
118
  exports.omitBy = toMerged.omitBy;
115
- exports.pick = toMerged.pick;
116
119
  exports.pickBy = toMerged.pickBy;
117
120
  exports.toMerged = toMerged.toMerged;
118
- exports.mergeWith = object_index.mergeWith;
121
+ exports.isDate = isWeakSet.isDate;
119
122
  exports.isEqual = isWeakSet.isEqual;
120
123
  exports.isFunction = isWeakSet.isFunction;
121
124
  exports.isLength = isWeakSet.isLength;
@@ -125,9 +128,9 @@ exports.isNull = isWeakSet.isNull;
125
128
  exports.isUndefined = isWeakSet.isUndefined;
126
129
  exports.isWeakMap = isWeakSet.isWeakMap;
127
130
  exports.isWeakSet = isWeakSet.isWeakSet;
128
- exports.isPlainObject = isTypedArray.isPlainObject;
129
- exports.isPrimitive = isTypedArray.isPrimitive;
130
- exports.isTypedArray = isTypedArray.isTypedArray;
131
+ exports.isPlainObject = isPlainObject.isPlainObject;
132
+ exports.isPrimitive = isPlainObject.isPrimitive;
133
+ exports.isTypedArray = isPlainObject.isTypedArray;
131
134
  exports.isBoolean = predicate_index.isBoolean;
132
135
  exports.isRegExp = predicate_index.isRegExp;
133
136
  exports.isString = predicate_index.isString;
@@ -144,5 +147,9 @@ exports.pad = string_index.pad;
144
147
  exports.pascalCase = string_index.pascalCase;
145
148
  exports.snakeCase = string_index.snakeCase;
146
149
  exports.startCase = string_index.startCase;
150
+ exports.trim = string_index.trim;
151
+ exports.trimEnd = string_index.trimEnd;
152
+ exports.trimStart = string_index.trimStart;
147
153
  exports.unescape = string_index.unescape;
154
+ exports.upperCase = string_index.upperCase;
148
155
  exports.upperFirst = string_index.upperFirst;
package/dist/index.mjs CHANGED
@@ -69,6 +69,7 @@ export { unary } from './function/unary.mjs';
69
69
  export { partial } from './function/partial.mjs';
70
70
  export { partialRight } from './function/partialRight.mjs';
71
71
  export { rest } from './function/rest.mjs';
72
+ export { curry } from './function/curry.mjs';
72
73
  export { spread } from './function/spread.mjs';
73
74
  export { clamp } from './math/clamp.mjs';
74
75
  export { inRange } from './math/inRange.mjs';
@@ -93,6 +94,7 @@ export { cloneDeep } from './object/cloneDeep.mjs';
93
94
  export { merge } from './object/merge.mjs';
94
95
  export { toMerged } from './object/toMerged.mjs';
95
96
  export { mergeWith } from './object/mergeWith.mjs';
97
+ export { isDate } from './predicate/isDate.mjs';
96
98
  export { isEqual } from './predicate/isEqual.mjs';
97
99
  export { isNil } from './predicate/isNil.mjs';
98
100
  export { isNotNil } from './predicate/isNotNil.mjs';
@@ -115,10 +117,14 @@ export { timeout } from './promise/timeout.mjs';
115
117
  export { camelCase } from './string/camelCase.mjs';
116
118
  export { snakeCase } from './string/snakeCase.mjs';
117
119
  export { kebabCase } from './string/kebabCase.mjs';
120
+ export { upperCase } from './string/upperCase.mjs';
118
121
  export { lowerCase } from './string/lowerCase.mjs';
119
122
  export { startCase } from './string/startCase.mjs';
120
123
  export { capitalize } from './string/capitalize.mjs';
121
124
  export { pascalCase } from './string/pascalCase.mjs';
125
+ export { trim } from './string/trim.mjs';
126
+ export { trimStart } from './string/trimStart.mjs';
127
+ export { trimEnd } from './string/trimEnd.mjs';
122
128
  export { upperFirst } from './string/upperFirst.mjs';
123
129
  export { lowerFirst } from './string/lowerFirst.mjs';
124
130
  export { deburr } from './string/deburr.mjs';
@@ -2,43 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
+ const range = require('../_chunk/range-BXlMmn.js');
5
6
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
6
7
 
7
- function clamp(value, bound1, bound2) {
8
- if (bound2 == null) {
9
- return Math.min(value, bound1);
10
- }
11
- return Math.min(Math.max(value, bound1), bound2);
12
- }
13
-
14
- function inRange(value, minimum, maximum) {
15
- if (maximum == null) {
16
- maximum = minimum;
17
- minimum = 0;
18
- }
19
- if (minimum >= maximum) {
20
- throw new Error('The maximum value must be greater than the minimum value.');
21
- }
22
- return minimum <= value && value < maximum;
23
- }
24
-
25
- function sum(nums) {
26
- let result = 0;
27
- for (let i = 0; i < nums.length; i++) {
28
- result += nums[i];
29
- }
30
- return result;
31
- }
32
-
33
- function mean(nums) {
34
- return sum(nums) / nums.length;
35
- }
36
-
37
- function meanBy(items, getValue) {
38
- const nums = items.map(x => getValue(x));
39
- return mean(nums);
40
- }
41
-
42
8
  function round(value, precision = 0) {
43
9
  if (!Number.isInteger(precision)) {
44
10
  throw new Error('Precision must be an integer.');
@@ -47,37 +13,13 @@ function round(value, precision = 0) {
47
13
  return Math.round(value * multiplier) / multiplier;
48
14
  }
49
15
 
50
- function sumBy(items, getValue) {
51
- const nums = items.map(x => getValue(x));
52
- return sum(nums);
53
- }
54
-
55
- function range(start, end, step) {
56
- if (end == null) {
57
- end = start;
58
- start = 0;
59
- }
60
- if (step == null) {
61
- step = 1;
62
- }
63
- if (!Number.isInteger(step) || step === 0) {
64
- throw new Error(`The step value must be a non-zero integer.`);
65
- }
66
- const length = Math.max(Math.ceil((end - start) / step), 0);
67
- const result = new Array(length);
68
- for (let i = 0; i < length; i++) {
69
- result[i] = start + i * step;
70
- }
71
- return result;
72
- }
73
-
16
+ exports.clamp = range.clamp;
17
+ exports.inRange = range.inRange;
18
+ exports.mean = range.mean;
19
+ exports.meanBy = range.meanBy;
20
+ exports.range = range.range;
21
+ exports.sum = range.sum;
22
+ exports.sumBy = range.sumBy;
74
23
  exports.random = randomInt.random;
75
24
  exports.randomInt = randomInt.randomInt;
76
- exports.clamp = clamp;
77
- exports.inRange = inRange;
78
- exports.mean = mean;
79
- exports.meanBy = meanBy;
80
- exports.range = range;
81
25
  exports.round = round;
82
- exports.sum = sum;
83
- exports.sumBy = sumBy;
@@ -1,39 +1,42 @@
1
+ import { isTypedArray } from '../predicate/isTypedArray.mjs';
2
+ import { isPrimitive } from '../predicate/isPrimitive.mjs';
3
+
1
4
  function clone(obj) {
2
5
  if (isPrimitive(obj)) {
3
6
  return obj;
4
7
  }
5
- if (Array.isArray(obj)) {
6
- return obj.slice();
8
+ if (Array.isArray(obj) || isTypedArray(obj) || obj instanceof ArrayBuffer || obj instanceof SharedArrayBuffer) {
9
+ return obj.slice(0);
7
10
  }
8
- if (obj instanceof Date) {
9
- return new Date(obj.getTime());
11
+ const prototype = Object.getPrototypeOf(obj);
12
+ const Constructor = prototype.constructor;
13
+ if (obj instanceof Date || obj instanceof Map || obj instanceof Set) {
14
+ return new Constructor(obj);
10
15
  }
11
16
  if (obj instanceof RegExp) {
12
- return new RegExp(obj.source, obj.flags);
13
- }
14
- if (obj instanceof Map) {
15
- const result = new Map();
16
- for (const [key, value] of obj) {
17
- result.set(key, value);
18
- }
19
- return result;
20
- }
21
- if (obj instanceof Set) {
22
- const result = new Set();
23
- for (const value of obj) {
24
- result.add(value);
25
- }
26
- return result;
17
+ const newRegExp = new Constructor(obj);
18
+ newRegExp.lastIndex = obj.lastIndex;
19
+ return newRegExp;
20
+ }
21
+ if (obj instanceof DataView) {
22
+ return new Constructor(obj.buffer.slice(0));
23
+ }
24
+ if (obj instanceof Error) {
25
+ const newError = new Constructor(obj.message);
26
+ newError.stack = obj.stack;
27
+ newError.name = obj.name;
28
+ newError.cause = obj.cause;
29
+ return newError;
30
+ }
31
+ if (typeof File !== 'undefined' && obj instanceof File) {
32
+ const newFile = new Constructor([obj], obj.name, { type: obj.type, lastModified: obj.lastModified });
33
+ return newFile;
27
34
  }
28
35
  if (typeof obj === 'object') {
29
- const prototype = Object.getPrototypeOf(obj);
30
- const result = Object.create(prototype);
31
- return Object.assign(result, obj);
36
+ const newObject = Object.create(prototype);
37
+ return Object.assign(newObject, obj);
32
38
  }
33
39
  return obj;
34
40
  }
35
- function isPrimitive(value) {
36
- return value == null || (typeof value !== 'object' && typeof value !== 'function');
37
- }
38
41
 
39
42
  export { clone };
@@ -2,7 +2,23 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const toMerged = require('../_chunk/toMerged-DN1PPP.js');
5
+ const toMerged = require('../_chunk/toMerged-Bzkqyz.js');
6
+
7
+ function omit(obj, keys) {
8
+ const result = { ...obj };
9
+ for (const key of keys) {
10
+ delete result[key];
11
+ }
12
+ return result;
13
+ }
14
+
15
+ function pick(obj, keys) {
16
+ const result = {};
17
+ for (const key of keys) {
18
+ result[key] = obj[key];
19
+ }
20
+ return result;
21
+ }
6
22
 
7
23
  function mergeWith(target, source, merge) {
8
24
  const sourceKeys = Object.keys(source);
@@ -34,9 +50,9 @@ exports.invert = toMerged.invert;
34
50
  exports.mapKeys = toMerged.mapKeys;
35
51
  exports.mapValues = toMerged.mapValues;
36
52
  exports.merge = toMerged.merge;
37
- exports.omit = toMerged.omit;
38
53
  exports.omitBy = toMerged.omitBy;
39
- exports.pick = toMerged.pick;
40
54
  exports.pickBy = toMerged.pickBy;
41
55
  exports.toMerged = toMerged.toMerged;
42
56
  exports.mergeWith = mergeWith;
57
+ exports.omit = omit;
58
+ exports.pick = pick;
@@ -15,6 +15,6 @@
15
15
  * const result = pick(obj, ['a', 'c']);
16
16
  * // result will be { a: 1, c: 3 }
17
17
  */
18
- declare function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
18
+ declare function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: readonly K[]): Pick<T, K>;
19
19
 
20
20
  export { pick };
@@ -15,6 +15,6 @@
15
15
  * const result = pick(obj, ['a', 'c']);
16
16
  * // result will be { a: 1, c: 3 }
17
17
  */
18
- declare function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
18
+ declare function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: readonly K[]): Pick<T, K>;
19
19
 
20
20
  export { pick };
@@ -1,3 +1,4 @@
1
+ export { isDate } from './isDate.mjs';
1
2
  export { isEqual } from './isEqual.mjs';
2
3
  export { isNil } from './isNil.mjs';
3
4
  export { isNotNil } from './isNotNil.mjs';
@@ -1,3 +1,4 @@
1
+ export { isDate } from './isDate.js';
1
2
  export { isEqual } from './isEqual.js';
2
3
  export { isNil } from './isNil.js';
3
4
  export { isNotNil } from './isNotNil.js';
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const isWeakSet = require('../_chunk/isWeakSet-CogETi.js');
6
- const isTypedArray = require('../_chunk/isTypedArray-Dsrnb1.js');
5
+ const isWeakSet = require('../_chunk/isWeakSet-E_VMwB.js');
6
+ const isPlainObject = require('../_chunk/isPlainObject-BIekvL.js');
7
7
 
8
8
  function isRegExp(value) {
9
9
  return value instanceof RegExp;
@@ -21,6 +21,7 @@ function isString(value) {
21
21
  return typeof value === 'string';
22
22
  }
23
23
 
24
+ exports.isDate = isWeakSet.isDate;
24
25
  exports.isEqual = isWeakSet.isEqual;
25
26
  exports.isFunction = isWeakSet.isFunction;
26
27
  exports.isLength = isWeakSet.isLength;
@@ -30,9 +31,9 @@ exports.isNull = isWeakSet.isNull;
30
31
  exports.isUndefined = isWeakSet.isUndefined;
31
32
  exports.isWeakMap = isWeakSet.isWeakMap;
32
33
  exports.isWeakSet = isWeakSet.isWeakSet;
33
- exports.isPlainObject = isTypedArray.isPlainObject;
34
- exports.isPrimitive = isTypedArray.isPrimitive;
35
- exports.isTypedArray = isTypedArray.isTypedArray;
34
+ exports.isPlainObject = isPlainObject.isPlainObject;
35
+ exports.isPrimitive = isPlainObject.isPrimitive;
36
+ exports.isTypedArray = isPlainObject.isTypedArray;
36
37
  exports.isBoolean = isBoolean;
37
38
  exports.isRegExp = isRegExp;
38
39
  exports.isString = isString;
@@ -1,3 +1,4 @@
1
+ export { isDate } from './isDate.mjs';
1
2
  export { isEqual } from './isEqual.mjs';
2
3
  export { isNil } from './isNil.mjs';
3
4
  export { isNotNil } from './isNotNil.mjs';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Checks if `value` is a Date object.
3
+ *
4
+ * @param {unknown} value The value to check.
5
+ * @returns {value is Date} Returns `true` if `value` is a Date object, `false` otherwise.
6
+ *
7
+ * @example
8
+ * const value1 = new Date();
9
+ * const value2 = '2024-01-01';
10
+ *
11
+ * console.log(isDate(value1)); // true
12
+ * console.log(isDate(value2)); // false
13
+ */
14
+ declare function isDate(value: unknown): value is Date;
15
+
16
+ export { isDate };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Checks if `value` is a Date object.
3
+ *
4
+ * @param {unknown} value The value to check.
5
+ * @returns {value is Date} Returns `true` if `value` is a Date object, `false` otherwise.
6
+ *
7
+ * @example
8
+ * const value1 = new Date();
9
+ * const value2 = '2024-01-01';
10
+ *
11
+ * console.log(isDate(value1)); // true
12
+ * console.log(isDate(value2)); // false
13
+ */
14
+ declare function isDate(value: unknown): value is Date;
15
+
16
+ export { isDate };
@@ -0,0 +1,5 @@
1
+ function isDate(value) {
2
+ return value instanceof Date;
3
+ }
4
+
5
+ export { isDate };
@@ -1,5 +1,5 @@
1
1
  function isNotNil(x) {
2
- return x !== null && x !== undefined;
2
+ return x != null;
3
3
  }
4
4
 
5
5
  export { isNotNil };
@@ -10,5 +10,6 @@
10
10
  * const result2 = capitalize('FRED') // returns 'Fred'
11
11
  */
12
12
  declare function capitalize<T extends string>(str: T): Capitalize<T>;
13
+ type Capitalize<T extends string> = T extends `${infer F}${infer R}` ? `${Uppercase<F>}${Lowercase<R>}` : T;
13
14
 
14
15
  export { capitalize };
@@ -10,5 +10,6 @@
10
10
  * const result2 = capitalize('FRED') // returns 'Fred'
11
11
  */
12
12
  declare function capitalize<T extends string>(str: T): Capitalize<T>;
13
+ type Capitalize<T extends string> = T extends `${infer F}${infer R}` ? `${Uppercase<F>}${Lowercase<R>}` : T;
13
14
 
14
15
  export { capitalize };
@@ -1,10 +1,14 @@
1
1
  export { camelCase } from './camelCase.mjs';
2
2
  export { snakeCase } from './snakeCase.mjs';
3
3
  export { kebabCase } from './kebabCase.mjs';
4
+ export { upperCase } from './upperCase.mjs';
4
5
  export { lowerCase } from './lowerCase.mjs';
5
6
  export { startCase } from './startCase.mjs';
6
7
  export { capitalize } from './capitalize.mjs';
7
8
  export { pascalCase } from './pascalCase.mjs';
9
+ export { trim } from './trim.mjs';
10
+ export { trimStart } from './trimStart.mjs';
11
+ export { trimEnd } from './trimEnd.mjs';
8
12
  export { upperFirst } from './upperFirst.mjs';
9
13
  export { lowerFirst } from './lowerFirst.mjs';
10
14
  export { deburr } from './deburr.mjs';
@@ -1,10 +1,14 @@
1
1
  export { camelCase } from './camelCase.js';
2
2
  export { snakeCase } from './snakeCase.js';
3
3
  export { kebabCase } from './kebabCase.js';
4
+ export { upperCase } from './upperCase.js';
4
5
  export { lowerCase } from './lowerCase.js';
5
6
  export { startCase } from './startCase.js';
6
7
  export { capitalize } from './capitalize.js';
7
8
  export { pascalCase } from './pascalCase.js';
9
+ export { trim } from './trim.js';
10
+ export { trimStart } from './trimStart.js';
11
+ export { trimEnd } from './trimEnd.js';
8
12
  export { upperFirst } from './upperFirst.js';
9
13
  export { lowerFirst } from './lowerFirst.js';
10
14
  export { deburr } from './deburr.js';