es-toolkit 1.3.1-dev.79 → 1.3.1-dev.81

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 (50) hide show
  1. package/dist/array/index.js +9 -2
  2. package/dist/array/index.js.map +1 -1
  3. package/dist/array/index.mjs +9 -9
  4. package/dist/array/unionBy.js +1 -1
  5. package/dist/array/unionBy.js.map +1 -1
  6. package/dist/array/unionBy.mjs +1 -1
  7. package/dist/array/uniqBy.js +6 -13
  8. package/dist/array/uniqBy.js.map +1 -1
  9. package/dist/array/uniqBy.mjs +1 -2
  10. package/dist/array/xorBy.js +1 -1
  11. package/dist/array/xorBy.js.map +1 -1
  12. package/dist/array/xorBy.mjs +2 -2
  13. package/dist/{chunk-EW3RT4QW.mjs → chunk-AM2EGFCU.mjs} +2 -2
  14. package/dist/{chunk-JBDGK6X4.mjs → chunk-NRNKP6JF.mjs} +2 -2
  15. package/dist/{chunk-JBDGK6X4.mjs.map → chunk-NRNKP6JF.mjs.map} +1 -1
  16. package/dist/chunk-QWJDITYJ.mjs +13 -0
  17. package/dist/chunk-QWJDITYJ.mjs.map +1 -0
  18. package/dist/{chunk-LJHSPVPM.mjs → chunk-UGFVAAVO.mjs} +1 -1
  19. package/dist/chunk-UGFVAAVO.mjs.map +1 -0
  20. package/dist/chunk-VAV4XHLO.mjs +1 -0
  21. package/dist/chunk-WPDDOUQT.mjs +16 -0
  22. package/dist/chunk-WPDDOUQT.mjs.map +1 -0
  23. package/dist/index.d.mts +1 -0
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +16 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +36 -32
  28. package/dist/math/index.d.mts +1 -0
  29. package/dist/math/index.d.ts +1 -0
  30. package/dist/math/index.js +7 -0
  31. package/dist/math/index.js.map +1 -1
  32. package/dist/math/index.mjs +6 -2
  33. package/dist/math/random.d.mts +1 -0
  34. package/dist/math/random.d.ts +1 -0
  35. package/dist/math/random.js.map +1 -1
  36. package/dist/math/random.mjs +1 -1
  37. package/dist/math/randomInt.d.mts +15 -0
  38. package/dist/math/randomInt.d.ts +15 -0
  39. package/dist/math/randomInt.js +43 -0
  40. package/dist/math/randomInt.js.map +1 -0
  41. package/dist/math/randomInt.mjs +9 -0
  42. package/dist/math/randomInt.mjs.map +1 -0
  43. package/dist/object/index.mjs +3 -3
  44. package/package.json +1 -1
  45. package/dist/chunk-ASFOKYTY.mjs +0 -13
  46. package/dist/chunk-ASFOKYTY.mjs.map +0 -1
  47. package/dist/chunk-LJHSPVPM.mjs.map +0 -1
  48. package/dist/chunk-NNIW65CD.mjs +0 -1
  49. /package/dist/{chunk-EW3RT4QW.mjs.map → chunk-AM2EGFCU.mjs.map} +0 -0
  50. /package/dist/{chunk-NNIW65CD.mjs.map → chunk-VAV4XHLO.mjs.map} +0 -0
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/math/randomInt.ts
21
+ var randomInt_exports = {};
22
+ __export(randomInt_exports, {
23
+ randomInt: () => randomInt
24
+ });
25
+ module.exports = __toCommonJS(randomInt_exports);
26
+
27
+ // src/math/random.ts
28
+ function random(minimum, maximum) {
29
+ if (minimum >= maximum) {
30
+ throw new Error("Invalid input: The maximum value must be greater than the minimum value.");
31
+ }
32
+ return Math.random() * (maximum - minimum) + minimum;
33
+ }
34
+
35
+ // src/math/randomInt.ts
36
+ function randomInt(minimum, maximum) {
37
+ return Math.floor(random(minimum, maximum));
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ randomInt
42
+ });
43
+ //# sourceMappingURL=randomInt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/math/randomInt.ts","../../src/math/random.ts"],"sourcesContent":["import { random } from './random';\n\n/**\n * Generates a random integer between minimum (inclusive) and maximum (exclusive).\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)\n * const result2 = randomInt(5, 0); // This will throw an error\n */\nexport function randomInt(minimum: number, maximum: number): number {\n return Math.floor(random(minimum, maximum));\n}\n","/**\n * Generates a random floating-point number between minimum (inclusive) and maximum (exclusive).\n * If min is greater than maximum, the values are swapped.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result = random(0, 5); // result will be a random floating-point number between 0 (inclusive) and 5 (exclusive)\n * const result2 = random(5, 0); // This will throw an error\n */\nexport function random(minimum: number, maximum: number): number {\n if (minimum >= maximum) {\n throw new Error('Invalid input: The maximum value must be greater than the minimum value.');\n }\n\n return Math.random() * (maximum - minimum) + minimum;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,OAAO,SAAiB,SAAyB;AAC/D,MAAI,WAAW,SAAS;AACtB,UAAM,IAAI,MAAM,0EAA0E;AAAA,EAC5F;AAEA,SAAO,KAAK,OAAO,KAAK,UAAU,WAAW;AAC/C;;;ADLO,SAAS,UAAU,SAAiB,SAAyB;AAClE,SAAO,KAAK,MAAM,OAAO,SAAS,OAAO,CAAC;AAC5C;","names":[]}
@@ -0,0 +1,9 @@
1
+ import {
2
+ randomInt
3
+ } from "../chunk-QWJDITYJ.mjs";
4
+ import "../chunk-UGFVAAVO.mjs";
5
+ import "../chunk-2MM5EJJX.mjs";
6
+ export {
7
+ randomInt
8
+ };
9
+ //# sourceMappingURL=randomInt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,7 @@
1
1
  import "../chunk-T5JCRGXA.mjs";
2
+ import {
3
+ pick
4
+ } from "../chunk-OFWKFUFZ.mjs";
2
5
  import {
3
6
  pickBy
4
7
  } from "../chunk-T2C2WVFL.mjs";
@@ -8,9 +11,6 @@ import {
8
11
  import {
9
12
  omitBy
10
13
  } from "../chunk-SF3V7XXM.mjs";
11
- import {
12
- pick
13
- } from "../chunk-OFWKFUFZ.mjs";
14
14
  import "../chunk-2MM5EJJX.mjs";
15
15
  export {
16
16
  omit,
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.3.1-dev.79+65a65ea2",
4
+ "version": "1.3.1-dev.81+67cb5eff",
5
5
  "workspaces": [
6
6
  "docs"
7
7
  ],
@@ -1,13 +0,0 @@
1
- import {
2
- uniqWith
3
- } from "./chunk-2PFDLYQC.mjs";
4
-
5
- // src/array/uniqBy.ts
6
- function uniqBy(arr, mapper) {
7
- return uniqWith(arr, (item1, item2) => mapper(item1) === mapper(item2));
8
- }
9
-
10
- export {
11
- uniqBy
12
- };
13
- //# sourceMappingURL=chunk-ASFOKYTY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/array/uniqBy.ts"],"sourcesContent":["import { uniqWith } from './uniqWith';\n\n/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the mapper function.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} mapper - The function used to convert the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[] {\n return uniqWith(arr, (item1, item2) => mapper(item1) === mapper(item2));\n}\n"],"mappings":";;;;;AAgBO,SAAS,OAAa,KAAmB,QAA6B;AAC3E,SAAO,SAAS,KAAK,CAAC,OAAO,UAAU,OAAO,KAAK,MAAM,OAAO,KAAK,CAAC;AACxE;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/math/random.ts"],"sourcesContent":["/**\n * Generates a random floating-point number between minimum (inclusive) and maximum (exclusive).\n * If min is greater than maximum, the values are swapped.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n *\n * @example\n * const result = random(0, 5); // result will be a random floating-point number between 0 (inclusive) and 5 (exclusive)\n * const result2 = random(5, 0); // This will throw an error\n */\nexport function random(minimum: number, maximum: number): number {\n if (minimum >= maximum) {\n throw new Error('Invalid input: The maximum value must be greater than the minimum value.');\n }\n\n return Math.random() * (maximum - minimum) + minimum;\n}\n"],"mappings":";AAYO,SAAS,OAAO,SAAiB,SAAyB;AAC/D,MAAI,WAAW,SAAS;AACtB,UAAM,IAAI,MAAM,0EAA0E;AAAA,EAC5F;AAEA,SAAO,KAAK,OAAO,KAAK,UAAU,WAAW;AAC/C;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-NNIW65CD.mjs.map