es-toolkit 1.29.0-dev.922 → 1.29.0-dev.924

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.
@@ -228,6 +228,12 @@ export { eq } from './util/eq.mjs';
228
228
  export { gt } from './util/gt.mjs';
229
229
  export { gte } from './util/gte.mjs';
230
230
  export { iteratee } from './util/iteratee.mjs';
231
+ export { now } from './util/now.mjs';
232
+ export { stubArray } from './util/stubArray.mjs';
233
+ export { stubFalse } from './util/stubFalse.mjs';
234
+ export { stubObject } from './util/stubObject.mjs';
235
+ export { stubString } from './util/stubString.mjs';
236
+ export { stubTrue } from './util/stubTrue.mjs';
231
237
  export { times } from './util/times.mjs';
232
238
  export { toArray } from './util/toArray.mjs';
233
239
  export { toFinite } from './util/toFinite.mjs';
@@ -237,4 +243,3 @@ export { toNumber } from './util/toNumber.mjs';
237
243
  export { toPath } from './util/toPath.mjs';
238
244
  export { toSafeInteger } from './util/toSafeInteger.mjs';
239
245
  export { toString } from './util/toString.mjs';
240
- export { uniqueId } from './util/uniqueId.mjs';
@@ -228,6 +228,12 @@ export { eq } from './util/eq.js';
228
228
  export { gt } from './util/gt.js';
229
229
  export { gte } from './util/gte.js';
230
230
  export { iteratee } from './util/iteratee.js';
231
+ export { now } from './util/now.js';
232
+ export { stubArray } from './util/stubArray.js';
233
+ export { stubFalse } from './util/stubFalse.js';
234
+ export { stubObject } from './util/stubObject.js';
235
+ export { stubString } from './util/stubString.js';
236
+ export { stubTrue } from './util/stubTrue.js';
231
237
  export { times } from './util/times.js';
232
238
  export { toArray } from './util/toArray.js';
233
239
  export { toFinite } from './util/toFinite.js';
@@ -237,4 +243,3 @@ export { toNumber } from './util/toNumber.js';
237
243
  export { toPath } from './util/toPath.js';
238
244
  export { toSafeInteger } from './util/toSafeInteger.js';
239
245
  export { toString } from './util/toString.js';
240
- export { uniqueId } from './util/uniqueId.js';
@@ -2698,6 +2698,30 @@ function gte(value, other) {
2698
2698
  return toNumber(value) >= toNumber(other);
2699
2699
  }
2700
2700
 
2701
+ function now() {
2702
+ return Date.now();
2703
+ }
2704
+
2705
+ function stubArray() {
2706
+ return [];
2707
+ }
2708
+
2709
+ function stubFalse() {
2710
+ return false;
2711
+ }
2712
+
2713
+ function stubObject() {
2714
+ return {};
2715
+ }
2716
+
2717
+ function stubString() {
2718
+ return '';
2719
+ }
2720
+
2721
+ function stubTrue() {
2722
+ return true;
2723
+ }
2724
+
2701
2725
  function toArray(value) {
2702
2726
  if (value == null) {
2703
2727
  return [];
@@ -2730,12 +2754,6 @@ function toSafeInteger(value) {
2730
2754
  return clamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
2731
2755
  }
2732
2756
 
2733
- let idCounter = 0;
2734
- function uniqueId(prefix = '') {
2735
- const id = ++idCounter;
2736
- return `${prefix}${id}`;
2737
- }
2738
-
2739
2757
  exports.at = zipWith.at;
2740
2758
  exports.countBy = zipWith.countBy;
2741
2759
  exports.differenceWith = zipWith.differenceWith;
@@ -2923,6 +2941,7 @@ exports.max = max;
2923
2941
  exports.merge = merge;
2924
2942
  exports.mergeWith = mergeWith;
2925
2943
  exports.min = min;
2944
+ exports.now = now;
2926
2945
  exports.omit = omit;
2927
2946
  exports.orderBy = orderBy;
2928
2947
  exports.pad = pad;
@@ -2948,6 +2967,11 @@ exports.sortBy = sortBy;
2948
2967
  exports.spread = spread;
2949
2968
  exports.startCase = startCase;
2950
2969
  exports.startsWith = startsWith;
2970
+ exports.stubArray = stubArray;
2971
+ exports.stubFalse = stubFalse;
2972
+ exports.stubObject = stubObject;
2973
+ exports.stubString = stubString;
2974
+ exports.stubTrue = stubTrue;
2951
2975
  exports.sum = sum;
2952
2976
  exports.sumBy = sumBy;
2953
2977
  exports.tail = tail;
@@ -2973,7 +2997,6 @@ exports.trimStart = trimStart;
2973
2997
  exports.union = union;
2974
2998
  exports.uniq = uniq;
2975
2999
  exports.uniqBy = uniqBy;
2976
- exports.uniqueId = uniqueId;
2977
3000
  exports.unset = unset;
2978
3001
  exports.unzip = unzip;
2979
3002
  exports.upperCase = upperCase;
@@ -227,6 +227,12 @@ export { defaultTo } from './util/defaultTo.mjs';
227
227
  export { gt } from './util/gt.mjs';
228
228
  export { gte } from './util/gte.mjs';
229
229
  export { iteratee } from './util/iteratee.mjs';
230
+ export { now } from './util/now.mjs';
231
+ export { stubArray } from './util/stubArray.mjs';
232
+ export { stubFalse } from './util/stubFalse.mjs';
233
+ export { stubObject } from './util/stubObject.mjs';
234
+ export { stubString } from './util/stubString.mjs';
235
+ export { stubTrue } from './util/stubTrue.mjs';
230
236
  export { times } from './util/times.mjs';
231
237
  export { toArray } from './util/toArray.mjs';
232
238
  export { toFinite } from './util/toFinite.mjs';
@@ -236,4 +242,3 @@ export { toNumber } from './util/toNumber.mjs';
236
242
  export { toPath } from './util/toPath.mjs';
237
243
  export { toSafeInteger } from './util/toSafeInteger.mjs';
238
244
  export { toString } from './util/toString.mjs';
239
- export { uniqueId } from './util/uniqueId.mjs';
@@ -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,5 @@
1
+ function now() {
2
+ return Date.now();
3
+ }
4
+
5
+ export { now };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns a new empty array.
3
+ *
4
+ * @returns {Array} A new empty array.
5
+ * @example
6
+ * stubArray() // Returns []
7
+ */
8
+ declare function stubArray(): [];
9
+
10
+ export { stubArray };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns a new empty array.
3
+ *
4
+ * @returns {Array} A new empty array.
5
+ * @example
6
+ * stubArray() // Returns []
7
+ */
8
+ declare function stubArray(): [];
9
+
10
+ export { stubArray };
@@ -0,0 +1,5 @@
1
+ function stubArray() {
2
+ return [];
3
+ }
4
+
5
+ export { stubArray };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns false.
3
+ *
4
+ * @returns {boolean} false.
5
+ * @example
6
+ * stubFalse() // Returns false
7
+ */
8
+ declare function stubFalse(): false;
9
+
10
+ export { stubFalse };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns false.
3
+ *
4
+ * @returns {boolean} false.
5
+ * @example
6
+ * stubFalse() // Returns false
7
+ */
8
+ declare function stubFalse(): false;
9
+
10
+ export { stubFalse };
@@ -0,0 +1,5 @@
1
+ function stubFalse() {
2
+ return false;
3
+ }
4
+
5
+ export { stubFalse };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns an empty object.
3
+ *
4
+ * @returns {Object} An empty object.
5
+ * @example
6
+ * stubObject() // Returns {}
7
+ */
8
+ declare function stubObject(): {};
9
+
10
+ export { stubObject };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns an empty object.
3
+ *
4
+ * @returns {Object} An empty object.
5
+ * @example
6
+ * stubObject() // Returns {}
7
+ */
8
+ declare function stubObject(): {};
9
+
10
+ export { stubObject };
@@ -0,0 +1,5 @@
1
+ function stubObject() {
2
+ return {};
3
+ }
4
+
5
+ export { stubObject };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns an empty string.
3
+ *
4
+ * @returns {string} An empty string.
5
+ * @example
6
+ * stubString() // Returns ''
7
+ */
8
+ declare function stubString(): '';
9
+
10
+ export { stubString };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns an empty string.
3
+ *
4
+ * @returns {string} An empty string.
5
+ * @example
6
+ * stubString() // Returns ''
7
+ */
8
+ declare function stubString(): '';
9
+
10
+ export { stubString };
@@ -0,0 +1,5 @@
1
+ function stubString() {
2
+ return '';
3
+ }
4
+
5
+ export { stubString };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns true.
3
+ *
4
+ * @returns {boolean} true.
5
+ * @example
6
+ * stubTrue() // Returns true
7
+ */
8
+ declare function stubTrue(): true;
9
+
10
+ export { stubTrue };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns true.
3
+ *
4
+ * @returns {boolean} true.
5
+ * @example
6
+ * stubTrue() // Returns true
7
+ */
8
+ declare function stubTrue(): true;
9
+
10
+ export { stubTrue };
@@ -0,0 +1,5 @@
1
+ function stubTrue() {
2
+ return true;
3
+ }
4
+
5
+ export { stubTrue };
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.29.0-dev.922+917aff01",
4
+ "version": "1.29.0-dev.924+7626af16",
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 };
@@ -1,7 +0,0 @@
1
- let idCounter = 0;
2
- function uniqueId(prefix = '') {
3
- const id = ++idCounter;
4
- return `${prefix}${id}`;
5
- }
6
-
7
- export { uniqueId };