es-toolkit 1.4.0-dev.93 → 1.4.0-dev.95
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/array/differenceWith.js.map +1 -1
- package/dist/array/differenceWith.mjs +1 -1
- package/dist/array/dropRightWhile.js.map +1 -1
- package/dist/array/dropRightWhile.mjs +2 -2
- package/dist/array/dropWhile.js.map +1 -1
- package/dist/array/dropWhile.mjs +1 -1
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +8 -8
- package/dist/array/intersectionWith.js.map +1 -1
- package/dist/array/intersectionWith.mjs +1 -1
- package/dist/array/unionWith.js.map +1 -1
- package/dist/array/unionWith.mjs +1 -1
- package/dist/array/xorWith.js.map +1 -1
- package/dist/array/xorWith.mjs +4 -4
- package/dist/array/zip.js.map +1 -1
- package/dist/array/zip.mjs +1 -1
- package/dist/array/zipWith.js.map +1 -1
- package/dist/array/zipWith.mjs +1 -1
- package/dist/{chunk-KLJRZJOR.mjs → chunk-2EFS3VA3.mjs} +1 -1
- package/dist/{chunk-KLJRZJOR.mjs.map → chunk-2EFS3VA3.mjs.map} +1 -1
- package/dist/{chunk-T5FDOBCA.mjs → chunk-4KYXHZ4R.mjs} +1 -1
- package/dist/{chunk-T5FDOBCA.mjs.map → chunk-4KYXHZ4R.mjs.map} +1 -1
- package/dist/{chunk-WWFZN6VL.mjs → chunk-5PMKOZ2F.mjs} +4 -1
- package/dist/chunk-5PMKOZ2F.mjs.map +1 -0
- package/dist/{chunk-3KHI4I2X.mjs → chunk-642SWVKJ.mjs} +1 -1
- package/dist/{chunk-3KHI4I2X.mjs.map → chunk-642SWVKJ.mjs.map} +1 -1
- package/dist/{chunk-FQ4K36VD.mjs → chunk-6NVQAHXP.mjs} +1 -1
- package/dist/{chunk-FQ4K36VD.mjs.map → chunk-6NVQAHXP.mjs.map} +1 -1
- package/dist/{chunk-DD73BULA.mjs → chunk-IDCUZVJL.mjs} +1 -1
- package/dist/{chunk-DD73BULA.mjs.map → chunk-IDCUZVJL.mjs.map} +1 -1
- package/dist/{chunk-JFHM6EY2.mjs → chunk-K2BAFL2T.mjs} +1 -1
- package/dist/{chunk-JFHM6EY2.mjs.map → chunk-K2BAFL2T.mjs.map} +1 -1
- package/dist/{chunk-CIRFWC7Y.mjs → chunk-RNJM5BHX.mjs} +2 -2
- package/dist/{chunk-VZUJ5PIA.mjs → chunk-SAL5OUAE.mjs} +1 -1
- package/dist/{chunk-VZUJ5PIA.mjs.map → chunk-SAL5OUAE.mjs.map} +1 -1
- package/dist/{chunk-FCF2RHPW.mjs → chunk-UMDNWTJC.mjs} +4 -4
- package/dist/{chunk-FCF2RHPW.mjs.map → chunk-UMDNWTJC.mjs.map} +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/math/index.js +3 -0
- package/dist/math/index.js.map +1 -1
- package/dist/math/index.mjs +2 -2
- package/dist/math/minBy.js.map +1 -1
- package/dist/math/minBy.mjs +1 -1
- package/dist/math/round.d.mts +2 -0
- package/dist/math/round.d.ts +2 -0
- package/dist/math/round.js +3 -0
- package/dist/math/round.js.map +1 -1
- package/dist/math/round.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-WWFZN6VL.mjs.map +0 -1
- /package/dist/{chunk-CIRFWC7Y.mjs.map → chunk-RNJM5BHX.mjs.map} +0 -0
package/dist/math/minBy.mjs
CHANGED
package/dist/math/round.d.mts
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
* @param {number} value - The number to round.
|
|
8
8
|
* @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.
|
|
9
9
|
* @returns {number} The rounded number.
|
|
10
|
+
* @throws {Error} Throws an error if `Precision` is not integer.
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
13
|
* const result1 = round(1.2345); // result1 will be 1
|
|
13
14
|
* const result2 = round(1.2345, 2); // result2 will be 1.23
|
|
14
15
|
* const result3 = round(1.2345, 3); // result3 will be 1.235
|
|
16
|
+
* const result4 = round(1.2345, 3.1); // This will throw an error
|
|
15
17
|
*/
|
|
16
18
|
declare function round(value: number, precision?: number): number;
|
|
17
19
|
|
package/dist/math/round.d.ts
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
* @param {number} value - The number to round.
|
|
8
8
|
* @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.
|
|
9
9
|
* @returns {number} The rounded number.
|
|
10
|
+
* @throws {Error} Throws an error if `Precision` is not integer.
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
13
|
* const result1 = round(1.2345); // result1 will be 1
|
|
13
14
|
* const result2 = round(1.2345, 2); // result2 will be 1.23
|
|
14
15
|
* const result3 = round(1.2345, 3); // result3 will be 1.235
|
|
16
|
+
* const result4 = round(1.2345, 3.1); // This will throw an error
|
|
15
17
|
*/
|
|
16
18
|
declare function round(value: number, precision?: number): number;
|
|
17
19
|
|
package/dist/math/round.js
CHANGED
|
@@ -24,6 +24,9 @@ __export(round_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(round_exports);
|
|
26
26
|
function round(value, precision = 0) {
|
|
27
|
+
if (!Number.isInteger(precision)) {
|
|
28
|
+
throw new Error("Precision must be an integer.");
|
|
29
|
+
}
|
|
27
30
|
const multiplier = Math.pow(10, precision);
|
|
28
31
|
return Math.round(value * multiplier) / multiplier;
|
|
29
32
|
}
|
package/dist/math/round.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/math/round.ts"],"sourcesContent":["/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n */\nexport function round(value: number, precision = 0): number {\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/math/round.ts"],"sourcesContent":["/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n * @throws {Error} Throws an error if `Precision` is not integer.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n * const result4 = round(1.2345, 3.1); // This will throw an error\n */\nexport function round(value: number, precision = 0): number {\n if (!Number.isInteger(precision)) {\n throw new Error('Precision must be an integer.');\n }\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,SAAS,MAAM,OAAe,YAAY,GAAW;AAC1D,MAAI,CAAC,OAAO,UAAU,SAAS,GAAG;AAChC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACA,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AACzC,SAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAC1C;","names":[]}
|
package/dist/math/round.mjs
CHANGED
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.0-dev.
|
|
4
|
+
"version": "1.4.0-dev.95+92c9db00",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"docs"
|
|
7
7
|
],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/math/round.ts"],"sourcesContent":["/**\n * Rounds a number to a specified precision.\n *\n * This function takes a number and an optional precision value, and returns the number rounded\n * to the specified number of decimal places.\n *\n * @param {number} value - The number to round.\n * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.\n * @returns {number} The rounded number.\n *\n * @example\n * const result1 = round(1.2345); // result1 will be 1\n * const result2 = round(1.2345, 2); // result2 will be 1.23\n * const result3 = round(1.2345, 3); // result3 will be 1.235\n */\nexport function round(value: number, precision = 0): number {\n const multiplier = Math.pow(10, precision);\n return Math.round(value * multiplier) / multiplier;\n}\n"],"mappings":";AAeO,SAAS,MAAM,OAAe,YAAY,GAAW;AAC1D,QAAM,aAAa,KAAK,IAAI,IAAI,SAAS;AACzC,SAAO,KAAK,MAAM,QAAQ,UAAU,IAAI;AAC1C;","names":[]}
|
|
File without changes
|