es-toolkit 1.17.0-dev.560 → 1.17.0-dev.562
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 +8 -0
- package/dist/compat/index.mjs +1 -0
- package/dist/compat/string/parseInt.d.mts +20 -0
- package/dist/compat/string/parseInt.d.ts +20 -0
- package/dist/compat/string/parseInt.mjs +8 -0
- package/package.json +1 -1
package/dist/compat/index.d.mts
CHANGED
|
@@ -159,5 +159,6 @@ export { endsWith } from './string/endsWith.mjs';
|
|
|
159
159
|
export { padStart } from './string/padStart.mjs';
|
|
160
160
|
export { padEnd } from './string/padEnd.mjs';
|
|
161
161
|
export { repeat } from './string/repeat.mjs';
|
|
162
|
+
export { parseInt } from './string/parseInt.mjs';
|
|
162
163
|
export { max } from './math/max.mjs';
|
|
163
164
|
export { min } from './math/min.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -159,5 +159,6 @@ export { endsWith } from './string/endsWith.js';
|
|
|
159
159
|
export { padStart } from './string/padStart.js';
|
|
160
160
|
export { padEnd } from './string/padEnd.js';
|
|
161
161
|
export { repeat } from './string/repeat.js';
|
|
162
|
+
export { parseInt } from './string/parseInt.js';
|
|
162
163
|
export { max } from './math/max.js';
|
|
163
164
|
export { min } from './math/min.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -987,6 +987,13 @@ function repeat(str, n) {
|
|
|
987
987
|
return str.repeat(n);
|
|
988
988
|
}
|
|
989
989
|
|
|
990
|
+
function parseInt(string, radix = 0, guard) {
|
|
991
|
+
if (guard) {
|
|
992
|
+
radix = 0;
|
|
993
|
+
}
|
|
994
|
+
return Number.parseInt(string, radix);
|
|
995
|
+
}
|
|
996
|
+
|
|
990
997
|
function max(items = []) {
|
|
991
998
|
let maxElement = items[0];
|
|
992
999
|
let max = undefined;
|
|
@@ -1164,6 +1171,7 @@ exports.min = min;
|
|
|
1164
1171
|
exports.orderBy = orderBy;
|
|
1165
1172
|
exports.padEnd = padEnd;
|
|
1166
1173
|
exports.padStart = padStart;
|
|
1174
|
+
exports.parseInt = parseInt;
|
|
1167
1175
|
exports.property = property;
|
|
1168
1176
|
exports.rearg = rearg;
|
|
1169
1177
|
exports.repeat = repeat;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -159,5 +159,6 @@ export { endsWith } from './string/endsWith.mjs';
|
|
|
159
159
|
export { padStart } from './string/padStart.mjs';
|
|
160
160
|
export { padEnd } from './string/padEnd.mjs';
|
|
161
161
|
export { repeat } from './string/repeat.mjs';
|
|
162
|
+
export { parseInt } from './string/parseInt.mjs';
|
|
162
163
|
export { max } from './math/max.mjs';
|
|
163
164
|
export { min } from './math/min.mjs';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} string The string to convert to an integer.
|
|
5
|
+
* @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`.
|
|
6
|
+
* @param {unknown} guard Enables use as an iteratee for methods like `Array#map`.
|
|
7
|
+
* @returns {number} Returns the converted integer.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* parseInt('08'); // => 8
|
|
11
|
+
* parseInt('0x20'); // => 32
|
|
12
|
+
*
|
|
13
|
+
* parseInt('08', 10); // => 8
|
|
14
|
+
* parseInt('0x20', 16); // => 32
|
|
15
|
+
*
|
|
16
|
+
* ['6', '08', '10'].map(parseInt); // => [6, 8, 10]
|
|
17
|
+
*/
|
|
18
|
+
declare function parseInt(string: string, radix?: number, guard?: unknown): number;
|
|
19
|
+
|
|
20
|
+
export { parseInt };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} string The string to convert to an integer.
|
|
5
|
+
* @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`.
|
|
6
|
+
* @param {unknown} guard Enables use as an iteratee for methods like `Array#map`.
|
|
7
|
+
* @returns {number} Returns the converted integer.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* parseInt('08'); // => 8
|
|
11
|
+
* parseInt('0x20'); // => 32
|
|
12
|
+
*
|
|
13
|
+
* parseInt('08', 10); // => 8
|
|
14
|
+
* parseInt('0x20', 16); // => 32
|
|
15
|
+
*
|
|
16
|
+
* ['6', '08', '10'].map(parseInt); // => [6, 8, 10]
|
|
17
|
+
*/
|
|
18
|
+
declare function parseInt(string: string, radix?: number, guard?: unknown): number;
|
|
19
|
+
|
|
20
|
+
export { parseInt };
|
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.17.0-dev.
|
|
4
|
+
"version": "1.17.0-dev.562+33bdce12",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|