es-toolkit 1.25.2-dev.817 → 1.25.2-dev.819
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/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +7 -0
- package/dist/compat/index.mjs +1 -0
- package/dist/compat/util/uniqueId.d.mts +25 -0
- package/dist/compat/util/uniqueId.d.ts +25 -0
- package/dist/compat/util/uniqueId.mjs +7 -0
- package/dist/object/merge.d.mts +1 -1
- package/dist/object/merge.d.ts +1 -1
- package/package.json +1 -1
package/dist/compat/index.d.mts
CHANGED
package/dist/compat/index.d.ts
CHANGED
package/dist/compat/index.js
CHANGED
|
@@ -2276,6 +2276,12 @@ function toSafeInteger(value) {
|
|
|
2276
2276
|
return clamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
|
2277
2277
|
}
|
|
2278
2278
|
|
|
2279
|
+
let idCounter = 0;
|
|
2280
|
+
function uniqueId(prefix = '') {
|
|
2281
|
+
const id = ++idCounter;
|
|
2282
|
+
return `${prefix}${id}`;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2279
2285
|
exports.at = zipWith.at;
|
|
2280
2286
|
exports.countBy = zipWith.countBy;
|
|
2281
2287
|
exports.differenceBy = zipWith.differenceBy;
|
|
@@ -2491,6 +2497,7 @@ exports.trim = trim;
|
|
|
2491
2497
|
exports.trimEnd = trimEnd;
|
|
2492
2498
|
exports.trimStart = trimStart;
|
|
2493
2499
|
exports.uniq = uniq;
|
|
2500
|
+
exports.uniqueId = uniqueId;
|
|
2494
2501
|
exports.unset = unset;
|
|
2495
2502
|
exports.upperCase = upperCase;
|
|
2496
2503
|
exports.without = without;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
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 };
|
|
@@ -0,0 +1,25 @@
|
|
|
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 };
|
package/dist/object/merge.d.mts
CHANGED
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
* console.log(result);
|
|
39
39
|
* // Output: { a: [1, 2, 3] }
|
|
40
40
|
*/
|
|
41
|
-
declare function merge<T, S
|
|
41
|
+
declare function merge<T extends Record<PropertyKey, any>, S extends Record<PropertyKey, any>>(target: T, source: S): T & S;
|
|
42
42
|
|
|
43
43
|
export { merge };
|
package/dist/object/merge.d.ts
CHANGED
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
* console.log(result);
|
|
39
39
|
* // Output: { a: [1, 2, 3] }
|
|
40
40
|
*/
|
|
41
|
-
declare function merge<T, S
|
|
41
|
+
declare function merge<T extends Record<PropertyKey, any>, S extends Record<PropertyKey, any>>(target: T, source: S): T & S;
|
|
42
42
|
|
|
43
43
|
export { merge };
|
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.25.2-dev.
|
|
4
|
+
"version": "1.25.2-dev.819+415d325f",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|