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.
- package/CHANGELOG.md +9 -0
- package/dist/_chunk/{rangeRight-w3WrXN.js → range-HnEIT7.js} +0 -17
- package/dist/_chunk/{zipWith-Bb2eZI.js → zipWith-nbzldx.js} +11 -10
- package/dist/array/index.d.mts +1 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.js +12 -2
- package/dist/array/index.mjs +1 -0
- package/dist/array/pull.d.mts +19 -0
- package/dist/array/pull.d.ts +19 -0
- package/dist/array/pull.mjs +11 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/isIndex.mjs +2 -2
- package/dist/compat/_internal/isPrototype.mjs +1 -1
- package/dist/compat/array/differenceWith.d.mts +91 -0
- package/dist/compat/array/differenceWith.d.ts +91 -0
- package/dist/compat/array/differenceWith.mjs +19 -0
- package/dist/compat/array/map.d.mts +182 -0
- package/dist/compat/array/map.d.ts +182 -0
- package/dist/compat/array/map.mjs +21 -0
- package/dist/compat/array/nth.d.mts +14 -0
- package/dist/compat/array/nth.d.ts +14 -0
- package/dist/compat/array/nth.mjs +15 -0
- package/dist/compat/array/pull.d.mts +19 -0
- package/dist/compat/array/pull.d.ts +19 -0
- package/dist/compat/array/pull.mjs +8 -0
- package/dist/compat/array/takeRightWhile.d.mts +84 -0
- package/dist/compat/array/takeRightWhile.d.ts +84 -0
- package/dist/compat/array/takeRightWhile.mjs +15 -0
- package/dist/compat/function/after.d.mts +31 -0
- package/dist/compat/function/after.d.ts +31 -0
- package/dist/compat/function/after.mjs +15 -0
- package/dist/compat/function/delay.d.mts +29 -0
- package/dist/compat/function/delay.d.ts +29 -0
- package/dist/compat/function/delay.mjs +10 -0
- package/dist/compat/function/nthArg.d.mts +22 -0
- package/dist/compat/function/nthArg.d.ts +22 -0
- package/dist/compat/function/nthArg.mjs +9 -0
- package/dist/compat/index.d.mts +30 -13
- package/dist/compat/index.d.ts +30 -13
- package/dist/compat/index.js +369 -56
- package/dist/compat/index.mjs +31 -13
- package/dist/compat/math/range.d.mts +47 -0
- package/dist/compat/math/range.d.ts +47 -0
- package/dist/compat/math/range.mjs +26 -0
- package/dist/compat/math/rangeRight.d.mts +47 -0
- package/dist/compat/math/rangeRight.d.ts +47 -0
- package/dist/compat/math/rangeRight.mjs +26 -0
- package/dist/compat/math/sumBy.d.mts +2 -2
- package/dist/compat/math/sumBy.d.ts +2 -2
- package/dist/compat/object/findKey.d.mts +58 -0
- package/dist/compat/object/findKey.d.ts +58 -0
- package/dist/compat/object/findKey.mjs +30 -0
- package/dist/compat/object/keys.d.mts +22 -0
- package/dist/compat/object/keys.d.ts +22 -0
- package/dist/compat/object/keys.mjs +32 -0
- package/dist/compat/object/propertyOf.d.mts +22 -0
- package/dist/compat/object/propertyOf.d.ts +22 -0
- package/dist/compat/object/propertyOf.mjs +9 -0
- package/dist/compat/predicate/isArrayLike.d.mts +1 -1
- package/dist/compat/predicate/isArrayLike.d.ts +1 -1
- package/dist/compat/predicate/isArrayLikeObject.d.mts +1 -1
- package/dist/compat/predicate/isArrayLikeObject.d.ts +1 -1
- package/dist/compat/predicate/isElement.d.mts +1 -1
- package/dist/compat/predicate/isElement.d.ts +1 -1
- package/dist/compat/predicate/isFinite.d.mts +1 -1
- package/dist/compat/predicate/isFinite.d.ts +1 -1
- package/dist/compat/predicate/isNaN.d.mts +1 -1
- package/dist/compat/predicate/isNaN.d.ts +1 -1
- package/dist/compat/predicate/isObject.d.mts +1 -1
- package/dist/compat/predicate/isObject.d.ts +1 -1
- package/dist/compat/predicate/isObjectLike.d.mts +1 -1
- package/dist/compat/predicate/isObjectLike.d.ts +1 -1
- package/dist/compat/string/deburr.d.mts +22 -0
- package/dist/compat/string/deburr.d.ts +22 -0
- package/dist/compat/string/deburr.mjs +8 -0
- package/dist/compat/string/escapeRegExp.d.mts +14 -0
- package/dist/compat/string/escapeRegExp.d.ts +14 -0
- package/dist/compat/string/escapeRegExp.mjs +8 -0
- package/dist/compat/string/lowerFirst.d.mts +14 -0
- package/dist/compat/string/lowerFirst.d.ts +14 -0
- package/dist/compat/string/lowerFirst.mjs +8 -0
- package/dist/compat/string/toLower.d.mts +20 -0
- package/dist/compat/string/toLower.d.ts +20 -0
- package/dist/compat/string/toLower.mjs +7 -0
- package/dist/compat/string/unescape.d.mts +16 -0
- package/dist/compat/string/unescape.d.ts +16 -0
- package/dist/compat/string/unescape.mjs +8 -0
- package/dist/compat/string/upperFirst.d.mts +14 -0
- package/dist/compat/string/upperFirst.d.ts +14 -0
- package/dist/compat/string/upperFirst.mjs +8 -0
- package/dist/compat/util/invoke.d.mts +23 -0
- package/dist/compat/util/invoke.d.ts +23 -0
- package/dist/compat/util/invoke.mjs +48 -0
- package/dist/compat/util/lt.d.mts +15 -0
- package/dist/compat/util/lt.d.ts +15 -0
- package/dist/compat/util/lt.mjs +10 -0
- package/dist/compat/util/lte.d.mts +15 -0
- package/dist/compat/util/lte.d.ts +15 -0
- package/dist/compat/util/lte.mjs +10 -0
- package/dist/compat/util/method.d.mts +22 -0
- package/dist/compat/util/method.d.ts +22 -0
- package/dist/compat/util/method.mjs +9 -0
- package/dist/compat/util/now.d.mts +18 -0
- package/dist/compat/util/now.d.ts +18 -0
- package/dist/compat/util/now.mjs +5 -0
- package/dist/compat/util/stubArray.d.mts +10 -0
- package/dist/compat/util/stubArray.d.ts +10 -0
- package/dist/compat/util/stubArray.mjs +5 -0
- package/dist/compat/util/stubFalse.d.mts +10 -0
- package/dist/compat/util/stubFalse.d.ts +10 -0
- package/dist/compat/util/stubFalse.mjs +5 -0
- package/dist/compat/util/stubObject.d.mts +10 -0
- package/dist/compat/util/stubObject.d.ts +10 -0
- package/dist/compat/util/stubObject.mjs +5 -0
- package/dist/compat/util/stubString.d.mts +10 -0
- package/dist/compat/util/stubString.d.ts +10 -0
- package/dist/compat/util/stubString.mjs +5 -0
- package/dist/compat/util/stubTrue.d.mts +10 -0
- package/dist/compat/util/stubTrue.d.ts +10 -0
- package/dist/compat/util/stubTrue.mjs +5 -0
- package/dist/compat/util/toArray.mjs +0 -3
- package/dist/compat/util/toPlainObject.d.mts +16 -0
- package/dist/compat/util/toPlainObject.d.ts +16 -0
- package/dist/compat/util/toPlainObject.mjs +24 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -12
- package/dist/index.mjs +1 -0
- package/dist/math/index.js +26 -10
- package/package.json +1 -1
- package/dist/compat/util/uniqueId.d.mts +0 -25
- package/dist/compat/util/uniqueId.d.ts +0 -25
- package/dist/compat/util/uniqueId.mjs +0 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if value is less than or equal to other.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to compare.
|
|
5
|
+
* @param {unknown} other The other value to compare.
|
|
6
|
+
* @returns {boolean} Returns `true` if value is less than or equal to other, else `false`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* lte(1, 3); // => true
|
|
10
|
+
* lte(3, 3); // => true
|
|
11
|
+
* lte(3, 1); // => false
|
|
12
|
+
*/
|
|
13
|
+
declare function lte(value: unknown, other: unknown): boolean;
|
|
14
|
+
|
|
15
|
+
export { lte };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that invokes the method at `path` of a given object with the provided arguments.
|
|
3
|
+
*
|
|
4
|
+
* @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke.
|
|
5
|
+
* @param {...any} args - The arguments to invoke the method with.
|
|
6
|
+
* @returns {(object?: unknown) => any} - Returns a new function that takes an object and invokes the method at `path` with `args`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const object = {
|
|
10
|
+
* a: {
|
|
11
|
+
* b: function (x, y) {
|
|
12
|
+
* return x + y;
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* };
|
|
16
|
+
*
|
|
17
|
+
* const add = method('a.b', 1, 2);
|
|
18
|
+
* console.log(add(object)); // => 3
|
|
19
|
+
*/
|
|
20
|
+
declare function method(path: PropertyKey | PropertyKey[], ...args: any[]): (object?: unknown) => any;
|
|
21
|
+
|
|
22
|
+
export { method };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that invokes the method at `path` of a given object with the provided arguments.
|
|
3
|
+
*
|
|
4
|
+
* @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke.
|
|
5
|
+
* @param {...any} args - The arguments to invoke the method with.
|
|
6
|
+
* @returns {(object?: unknown) => any} - Returns a new function that takes an object and invokes the method at `path` with `args`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const object = {
|
|
10
|
+
* a: {
|
|
11
|
+
* b: function (x, y) {
|
|
12
|
+
* return x + y;
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* };
|
|
16
|
+
*
|
|
17
|
+
* const add = method('a.b', 1, 2);
|
|
18
|
+
* console.log(add(object)); // => 3
|
|
19
|
+
*/
|
|
20
|
+
declare function method(path: PropertyKey | PropertyKey[], ...args: any[]): (object?: unknown) => any;
|
|
21
|
+
|
|
22
|
+
export { method };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
|
|
3
|
+
*
|
|
4
|
+
* @returns {number} The current time in milliseconds.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const currentTime = now();
|
|
8
|
+
* console.log(currentTime); // Outputs the current time in milliseconds
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const startTime = now();
|
|
12
|
+
* // Some time-consuming operation
|
|
13
|
+
* const endTime = now();
|
|
14
|
+
* console.log(`Operation took ${endTime - startTime} milliseconds`);
|
|
15
|
+
*/
|
|
16
|
+
declare function now(): number;
|
|
17
|
+
|
|
18
|
+
export { now };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
|
|
3
|
+
*
|
|
4
|
+
* @returns {number} The current time in milliseconds.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const currentTime = now();
|
|
8
|
+
* console.log(currentTime); // Outputs the current time in milliseconds
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const startTime = now();
|
|
12
|
+
* // Some time-consuming operation
|
|
13
|
+
* const endTime = now();
|
|
14
|
+
* console.log(`Operation took ${endTime - startTime} milliseconds`);
|
|
15
|
+
*/
|
|
16
|
+
declare function now(): number;
|
|
17
|
+
|
|
18
|
+
export { now };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object.
|
|
3
|
+
*
|
|
4
|
+
* @param {any} value The value to convert.
|
|
5
|
+
* @returns {Record<string, any>} Returns the converted plain object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* function Foo() {
|
|
9
|
+
* this.b = 2;
|
|
10
|
+
* }
|
|
11
|
+
* Foo.prototype.c = 3;
|
|
12
|
+
* toPlainObject(new Foo()); // { b: 2, c: 3 }
|
|
13
|
+
*/
|
|
14
|
+
declare function toPlainObject(value: any): Record<string, any>;
|
|
15
|
+
|
|
16
|
+
export { toPlainObject };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object.
|
|
3
|
+
*
|
|
4
|
+
* @param {any} value The value to convert.
|
|
5
|
+
* @returns {Record<string, any>} Returns the converted plain object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* function Foo() {
|
|
9
|
+
* this.b = 2;
|
|
10
|
+
* }
|
|
11
|
+
* Foo.prototype.c = 3;
|
|
12
|
+
* toPlainObject(new Foo()); // { b: 2, c: 3 }
|
|
13
|
+
*/
|
|
14
|
+
declare function toPlainObject(value: any): Record<string, any>;
|
|
15
|
+
|
|
16
|
+
export { toPlainObject };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { keysIn } from '../object/keysIn.mjs';
|
|
2
|
+
|
|
3
|
+
function toPlainObject(value) {
|
|
4
|
+
const plainObject = {};
|
|
5
|
+
const valueKeys = keysIn(value);
|
|
6
|
+
for (let i = 0; i < valueKeys.length; i++) {
|
|
7
|
+
const key = valueKeys[i];
|
|
8
|
+
const objValue = value[key];
|
|
9
|
+
if (key === '__proto__') {
|
|
10
|
+
Object.defineProperty(plainObject, key, {
|
|
11
|
+
configurable: true,
|
|
12
|
+
enumerable: true,
|
|
13
|
+
value: objValue,
|
|
14
|
+
writable: true,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
plainObject[key] = objValue;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return plainObject;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { toPlainObject };
|
package/dist/index.d.mts
CHANGED
|
@@ -29,6 +29,7 @@ export { maxBy } from './array/maxBy.mjs';
|
|
|
29
29
|
export { minBy } from './array/minBy.mjs';
|
|
30
30
|
export { orderBy } from './array/orderBy.mjs';
|
|
31
31
|
export { partition } from './array/partition.mjs';
|
|
32
|
+
export { pull } from './array/pull.mjs';
|
|
32
33
|
export { pullAt } from './array/pullAt.mjs';
|
|
33
34
|
export { sample } from './array/sample.mjs';
|
|
34
35
|
export { sampleSize } from './array/sampleSize.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export { maxBy } from './array/maxBy.js';
|
|
|
29
29
|
export { minBy } from './array/minBy.js';
|
|
30
30
|
export { orderBy } from './array/orderBy.js';
|
|
31
31
|
export { partition } from './array/partition.js';
|
|
32
|
+
export { pull } from './array/pull.js';
|
|
32
33
|
export { pullAt } from './array/pullAt.js';
|
|
33
34
|
export { sample } from './array/sample.js';
|
|
34
35
|
export { sampleSize } from './array/sampleSize.js';
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const zipWith = require('./_chunk/zipWith-
|
|
5
|
+
const zipWith = require('./_chunk/zipWith-nbzldx.js');
|
|
6
6
|
const array_index = require('./array/index.js');
|
|
7
7
|
const promise_index = require('./_chunk/index-BGZDR9.js');
|
|
8
8
|
const unary = require('./_chunk/unary-CcTNuC.js');
|
|
9
9
|
const function_index = require('./function/index.js');
|
|
10
10
|
const noop = require('./_chunk/noop-2IwLUk.js');
|
|
11
|
-
const
|
|
11
|
+
const range = require('./_chunk/range-HnEIT7.js');
|
|
12
12
|
const randomInt = require('./_chunk/randomInt-CF7bZK.js');
|
|
13
13
|
const math_index = require('./math/index.js');
|
|
14
14
|
const toMerged = require('./_chunk/toMerged-DGFrN7.js');
|
|
@@ -52,6 +52,7 @@ exports.last = zipWith.last;
|
|
|
52
52
|
exports.maxBy = zipWith.maxBy;
|
|
53
53
|
exports.minBy = zipWith.minBy;
|
|
54
54
|
exports.partition = zipWith.partition;
|
|
55
|
+
exports.pull = zipWith.pull;
|
|
55
56
|
exports.pullAt = zipWith.pullAt;
|
|
56
57
|
exports.sample = zipWith.sample;
|
|
57
58
|
exports.sampleSize = zipWith.sampleSize;
|
|
@@ -59,7 +60,6 @@ exports.shuffle = zipWith.shuffle;
|
|
|
59
60
|
exports.tail = zipWith.tail;
|
|
60
61
|
exports.take = zipWith.take;
|
|
61
62
|
exports.takeRight = zipWith.takeRight;
|
|
62
|
-
exports.takeRightWhile = zipWith.takeRightWhile;
|
|
63
63
|
exports.takeWhile = zipWith.takeWhile;
|
|
64
64
|
exports.toFilled = zipWith.toFilled;
|
|
65
65
|
exports.union = zipWith.union;
|
|
@@ -79,6 +79,7 @@ exports.zipObject = zipWith.zipObject;
|
|
|
79
79
|
exports.zipWith = zipWith.zipWith;
|
|
80
80
|
exports.orderBy = array_index.orderBy;
|
|
81
81
|
exports.sortBy = array_index.sortBy;
|
|
82
|
+
exports.takeRightWhile = array_index.takeRightWhile;
|
|
82
83
|
exports.AbortError = promise_index.AbortError;
|
|
83
84
|
exports.TimeoutError = promise_index.TimeoutError;
|
|
84
85
|
exports.delay = promise_index.delay;
|
|
@@ -103,17 +104,17 @@ exports.curryRight = function_index.curryRight;
|
|
|
103
104
|
exports.spread = function_index.spread;
|
|
104
105
|
exports.throttle = function_index.throttle;
|
|
105
106
|
exports.noop = noop.noop;
|
|
106
|
-
exports.clamp =
|
|
107
|
-
exports.inRange =
|
|
108
|
-
exports.mean =
|
|
109
|
-
exports.meanBy =
|
|
110
|
-
exports.median =
|
|
111
|
-
exports.medianBy =
|
|
112
|
-
exports.range =
|
|
113
|
-
exports.
|
|
114
|
-
exports.sum = rangeRight.sum;
|
|
107
|
+
exports.clamp = range.clamp;
|
|
108
|
+
exports.inRange = range.inRange;
|
|
109
|
+
exports.mean = range.mean;
|
|
110
|
+
exports.meanBy = range.meanBy;
|
|
111
|
+
exports.median = range.median;
|
|
112
|
+
exports.medianBy = range.medianBy;
|
|
113
|
+
exports.range = range.range;
|
|
114
|
+
exports.sum = range.sum;
|
|
115
115
|
exports.random = randomInt.random;
|
|
116
116
|
exports.randomInt = randomInt.randomInt;
|
|
117
|
+
exports.rangeRight = math_index.rangeRight;
|
|
117
118
|
exports.round = math_index.round;
|
|
118
119
|
exports.sumBy = math_index.sumBy;
|
|
119
120
|
exports.clone = toMerged.clone;
|
package/dist/index.mjs
CHANGED
|
@@ -29,6 +29,7 @@ export { maxBy } from './array/maxBy.mjs';
|
|
|
29
29
|
export { minBy } from './array/minBy.mjs';
|
|
30
30
|
export { orderBy } from './array/orderBy.mjs';
|
|
31
31
|
export { partition } from './array/partition.mjs';
|
|
32
|
+
export { pull } from './array/pull.mjs';
|
|
32
33
|
export { pullAt } from './array/pullAt.mjs';
|
|
33
34
|
export { sample } from './array/sample.mjs';
|
|
34
35
|
export { sampleSize } from './array/sampleSize.mjs';
|
package/dist/math/index.js
CHANGED
|
@@ -2,9 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const range = require('../_chunk/range-HnEIT7.js');
|
|
6
6
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
7
7
|
|
|
8
|
+
function rangeRight(start, end, step = 1) {
|
|
9
|
+
if (end == null) {
|
|
10
|
+
end = start;
|
|
11
|
+
start = 0;
|
|
12
|
+
}
|
|
13
|
+
if (!Number.isInteger(step) || step === 0) {
|
|
14
|
+
throw new Error(`The step value must be a non-zero integer.`);
|
|
15
|
+
}
|
|
16
|
+
const length = Math.max(Math.ceil((end - start) / step), 0);
|
|
17
|
+
const result = new Array(length);
|
|
18
|
+
for (let i = 0; i < length; i++) {
|
|
19
|
+
result[i] = start + (length - i - 1) * step;
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
|
|
8
24
|
function round(value, precision = 0) {
|
|
9
25
|
if (!Number.isInteger(precision)) {
|
|
10
26
|
throw new Error('Precision must be an integer.');
|
|
@@ -21,16 +37,16 @@ function sumBy(items, getValue) {
|
|
|
21
37
|
return result;
|
|
22
38
|
}
|
|
23
39
|
|
|
24
|
-
exports.clamp =
|
|
25
|
-
exports.inRange =
|
|
26
|
-
exports.mean =
|
|
27
|
-
exports.meanBy =
|
|
28
|
-
exports.median =
|
|
29
|
-
exports.medianBy =
|
|
30
|
-
exports.range =
|
|
31
|
-
exports.
|
|
32
|
-
exports.sum = rangeRight.sum;
|
|
40
|
+
exports.clamp = range.clamp;
|
|
41
|
+
exports.inRange = range.inRange;
|
|
42
|
+
exports.mean = range.mean;
|
|
43
|
+
exports.meanBy = range.meanBy;
|
|
44
|
+
exports.median = range.median;
|
|
45
|
+
exports.medianBy = range.medianBy;
|
|
46
|
+
exports.range = range.range;
|
|
47
|
+
exports.sum = range.sum;
|
|
33
48
|
exports.random = randomInt.random;
|
|
34
49
|
exports.randomInt = randomInt.randomInt;
|
|
50
|
+
exports.rangeRight = rangeRight;
|
|
35
51
|
exports.round = round;
|
|
36
52
|
exports.sumBy = sumBy;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.30.0",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a unique identifier, optionally prefixed with a given string.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} [prefix] - An optional string to prefix the unique identifier.
|
|
5
|
-
* If not provided or not a string, only the unique
|
|
6
|
-
* numeric identifier is returned.
|
|
7
|
-
* @returns {string} A string containing the unique identifier, with the optional
|
|
8
|
-
* prefix if provided.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // Generate a unique ID with a prefix
|
|
12
|
-
* uniqueId('user_'); // => 'user_1'
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* // Generate a unique ID without a prefix
|
|
16
|
-
* uniqueId(); // => '2'
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // Subsequent calls increment the internal counter
|
|
20
|
-
* uniqueId('item_'); // => 'item_3'
|
|
21
|
-
* uniqueId(); // => '4'
|
|
22
|
-
*/
|
|
23
|
-
declare function uniqueId(prefix?: string): string;
|
|
24
|
-
|
|
25
|
-
export { uniqueId };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a unique identifier, optionally prefixed with a given string.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} [prefix] - An optional string to prefix the unique identifier.
|
|
5
|
-
* If not provided or not a string, only the unique
|
|
6
|
-
* numeric identifier is returned.
|
|
7
|
-
* @returns {string} A string containing the unique identifier, with the optional
|
|
8
|
-
* prefix if provided.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // Generate a unique ID with a prefix
|
|
12
|
-
* uniqueId('user_'); // => 'user_1'
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* // Generate a unique ID without a prefix
|
|
16
|
-
* uniqueId(); // => '2'
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // Subsequent calls increment the internal counter
|
|
20
|
-
* uniqueId('item_'); // => 'item_3'
|
|
21
|
-
* uniqueId(); // => '4'
|
|
22
|
-
*/
|
|
23
|
-
declare function uniqueId(prefix?: string): string;
|
|
24
|
-
|
|
25
|
-
export { uniqueId };
|