es-toolkit 1.20.0 → 1.21.0-dev.660
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/CHANGELOG.md +13 -0
- package/dist/_chunk/{isWeakSet-E_VMwB.js → isWeakSet-1xFSnK.js} +5 -0
- package/dist/_chunk/{toMerged-Bzkqyz.js → toMerged-D-sLFv.js} +10 -8
- package/dist/_chunk/{zipWith-CDtN9Y.js → zipWith-DEcUS4.js} +25 -12
- package/dist/array/compact.d.mts +4 -4
- package/dist/array/compact.d.ts +4 -4
- package/dist/array/compact.mjs +2 -1
- package/dist/array/countBy.mjs +2 -1
- package/dist/array/flatten.mjs +2 -1
- package/dist/array/groupBy.mjs +2 -1
- package/dist/array/index.js +1 -1
- package/dist/array/keyBy.mjs +2 -1
- package/dist/array/maxBy.d.mts +16 -0
- package/dist/array/maxBy.d.ts +16 -0
- package/dist/array/maxBy.mjs +2 -1
- package/dist/array/minBy.d.mts +16 -0
- package/dist/array/minBy.d.ts +16 -0
- package/dist/array/minBy.mjs +2 -1
- package/dist/array/partition.mjs +2 -1
- package/dist/array/takeWhile.mjs +2 -1
- package/dist/array/unionBy.mjs +3 -1
- package/dist/array/uniqBy.mjs +2 -1
- package/dist/array/uniqWith.mjs +2 -1
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/castArray.d.mts +2 -2
- package/dist/compat/array/castArray.d.ts +2 -2
- package/dist/compat/array/flatten.mjs +2 -1
- package/dist/compat/function/curry.mjs +26 -34
- package/dist/compat/function/defer.d.mts +16 -0
- package/dist/compat/function/defer.d.ts +16 -0
- package/dist/compat/function/defer.mjs +8 -0
- package/dist/compat/index.d.mts +13 -5
- package/dist/compat/index.d.ts +13 -5
- package/dist/compat/index.js +200 -71
- package/dist/compat/index.mjs +14 -6
- package/dist/compat/math/inRange.d.mts +27 -0
- package/dist/compat/math/inRange.d.ts +27 -0
- package/dist/compat/math/inRange.mjs +28 -0
- package/dist/compat/math/max.mjs +2 -1
- package/dist/compat/math/min.mjs +2 -1
- package/dist/compat/math/random.d.mts +50 -0
- package/dist/compat/math/random.d.ts +50 -0
- package/dist/compat/math/random.mjs +70 -0
- package/dist/compat/object/cloneDeep.d.mts +49 -0
- package/dist/compat/object/cloneDeep.d.ts +49 -0
- package/dist/compat/object/pick.mjs +2 -1
- package/dist/compat/predicate/conformsTo.mjs +3 -1
- package/dist/compat/predicate/isArrayLikeObject.d.mts +15 -0
- package/dist/compat/predicate/isArrayLikeObject.d.ts +15 -0
- package/dist/compat/predicate/isArrayLikeObject.mjs +8 -0
- package/dist/compat/predicate/isBoolean.d.mts +3 -3
- package/dist/compat/predicate/isBoolean.d.ts +3 -3
- package/dist/compat/predicate/isBoolean.mjs +2 -10
- package/dist/compat/predicate/isError.d.mts +16 -0
- package/dist/compat/predicate/isError.d.ts +16 -0
- package/dist/compat/predicate/isError.mjs +7 -0
- package/dist/compat/predicate/isFinite.d.mts +20 -0
- package/dist/compat/predicate/isFinite.d.ts +20 -0
- package/dist/compat/predicate/isFinite.mjs +5 -0
- package/dist/compat/predicate/isNil.d.mts +22 -0
- package/dist/compat/predicate/isNil.d.ts +22 -0
- package/dist/compat/predicate/isNumber.mjs +1 -6
- package/dist/compat/predicate/isRegExp.mjs +2 -2
- package/dist/compat/predicate/isString.d.mts +1 -1
- package/dist/compat/predicate/isString.d.ts +1 -1
- package/dist/compat/predicate/isString.mjs +1 -9
- package/dist/compat/predicate/isSymbol.mjs +1 -1
- package/dist/compat/string/pad.d.mts +19 -0
- package/dist/compat/string/pad.d.ts +19 -0
- package/dist/compat/string/pad.mjs +8 -0
- package/dist/compat/string/padEnd.mjs +3 -1
- package/dist/compat/string/padStart.mjs +3 -1
- package/dist/compat/util/toFinite.d.mts +17 -0
- package/dist/compat/util/toFinite.d.ts +17 -0
- package/dist/compat/util/toFinite.mjs +15 -0
- package/dist/compat/util/toInteger.d.mts +17 -0
- package/dist/compat/util/toInteger.d.ts +17 -0
- package/dist/compat/util/toInteger.mjs +9 -0
- package/dist/compat/util/toNumber.d.mts +19 -0
- package/dist/compat/util/toNumber.d.ts +19 -0
- package/dist/compat/util/toNumber.mjs +10 -0
- package/dist/function/curry.d.mts +18 -19
- package/dist/function/curry.d.ts +18 -19
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -8
- package/dist/index.mjs +2 -0
- package/dist/math/random.d.mts +1 -1
- package/dist/math/random.d.ts +1 -1
- package/dist/math/range.d.mts +7 -25
- package/dist/math/range.d.ts +7 -25
- package/dist/object/index.js +8 -4
- package/dist/object/omit.d.mts +1 -1
- package/dist/object/omit.d.ts +1 -1
- package/dist/object/omit.mjs +2 -1
- package/dist/object/omitBy.mjs +5 -4
- package/dist/object/pick.mjs +5 -2
- package/dist/object/pickBy.mjs +5 -4
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +5 -4
- package/dist/predicate/index.mjs +1 -0
- package/dist/predicate/isError.d.mts +16 -0
- package/dist/predicate/isError.d.ts +16 -0
- package/dist/predicate/isError.mjs +5 -0
- package/dist/promise/withTimeout.d.mts +8 -2
- package/dist/promise/withTimeout.d.ts +8 -2
- package/dist/string/_internal/getWords.mjs +1 -1
- package/dist/string/camelCase.d.mts +1 -0
- package/dist/string/camelCase.d.ts +1 -0
- package/dist/string/constantCase.d.mts +17 -0
- package/dist/string/constantCase.d.ts +17 -0
- package/dist/string/constantCase.mjs +8 -0
- package/dist/string/index.d.mts +1 -0
- package/dist/string/index.d.ts +1 -0
- package/dist/string/index.js +10 -8
- package/dist/string/index.mjs +1 -0
- package/dist/string/startCase.d.mts +1 -1
- package/dist/string/startCase.d.ts +1 -1
- package/dist/string/startCase.mjs +3 -7
- package/dist/string/trimStart.d.mts +1 -1
- package/dist/string/trimStart.d.ts +1 -1
- package/dist/string/upperFirst.d.mts +3 -3
- package/dist/string/upperFirst.d.ts +3 -3
- package/package.json +2 -1
package/dist/predicate/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const isWeakSet = require('../_chunk/isWeakSet-
|
|
5
|
+
const isWeakSet = require('../_chunk/isWeakSet-1xFSnK.js');
|
|
6
6
|
const isPlainObject = require('../_chunk/isPlainObject-BIekvL.js');
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
return value instanceof
|
|
8
|
+
function isError(value) {
|
|
9
|
+
return value instanceof Error;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function isBoolean(x) {
|
|
@@ -28,6 +28,7 @@ exports.isLength = isWeakSet.isLength;
|
|
|
28
28
|
exports.isNil = isWeakSet.isNil;
|
|
29
29
|
exports.isNotNil = isWeakSet.isNotNil;
|
|
30
30
|
exports.isNull = isWeakSet.isNull;
|
|
31
|
+
exports.isRegExp = isWeakSet.isRegExp;
|
|
31
32
|
exports.isUndefined = isWeakSet.isUndefined;
|
|
32
33
|
exports.isWeakMap = isWeakSet.isWeakMap;
|
|
33
34
|
exports.isWeakSet = isWeakSet.isWeakSet;
|
|
@@ -35,6 +36,6 @@ exports.isPlainObject = isPlainObject.isPlainObject;
|
|
|
35
36
|
exports.isPrimitive = isPlainObject.isPrimitive;
|
|
36
37
|
exports.isTypedArray = isPlainObject.isTypedArray;
|
|
37
38
|
exports.isBoolean = isBoolean;
|
|
38
|
-
exports.
|
|
39
|
+
exports.isError = isError;
|
|
39
40
|
exports.isString = isString;
|
|
40
41
|
exports.isSymbol = isSymbol;
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is an Error object.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to check.
|
|
5
|
+
* @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* console.log(isError(new Error())); // true
|
|
10
|
+
* console.log(isError('Error')); // false
|
|
11
|
+
* console.log(isError({ name: 'Error', message: '' })); // false
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare function isError(value: unknown): value is Error;
|
|
15
|
+
|
|
16
|
+
export { isError };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is an Error object.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to check.
|
|
5
|
+
* @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* console.log(isError(new Error())); // true
|
|
10
|
+
* console.log(isError('Error')); // false
|
|
11
|
+
* console.log(isError({ name: 'Error', message: '' })); // false
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare function isError(value: unknown): value is Error;
|
|
15
|
+
|
|
16
|
+
export { isError };
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
* @returns {Promise<T>} A promise that resolves with the result of the `run` function or rejects if the timeout is reached.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
+
* async function fetchData() {
|
|
15
|
+
* const response = await fetch('https://example.com/data');
|
|
16
|
+
* return response.json();
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
14
19
|
* try {
|
|
15
|
-
* await withTimeout(
|
|
20
|
+
* const data = await withTimeout(fetchData, 1000);
|
|
21
|
+
* console.log(data); // Logs the fetched data if `fetchData` is resolved within 1 second.
|
|
16
22
|
* } catch (error) {
|
|
17
|
-
* console.error(error); // Will log 'TimeoutError'
|
|
23
|
+
* console.error(error); // Will log 'TimeoutError' if `fetchData` is not resolved within 1 second.
|
|
18
24
|
* }
|
|
19
25
|
*/
|
|
20
26
|
declare function withTimeout<T>(run: () => Promise<T>, ms: number): Promise<T>;
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
* @returns {Promise<T>} A promise that resolves with the result of the `run` function or rejects if the timeout is reached.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
+
* async function fetchData() {
|
|
15
|
+
* const response = await fetch('https://example.com/data');
|
|
16
|
+
* return response.json();
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
14
19
|
* try {
|
|
15
|
-
* await withTimeout(
|
|
20
|
+
* const data = await withTimeout(fetchData, 1000);
|
|
21
|
+
* console.log(data); // Logs the fetched data if `fetchData` is resolved within 1 second.
|
|
16
22
|
* } catch (error) {
|
|
17
|
-
* console.error(error); // Will log 'TimeoutError'
|
|
23
|
+
* console.error(error); // Will log 'TimeoutError' if `fetchData` is not resolved within 1 second.
|
|
18
24
|
* }
|
|
19
25
|
*/
|
|
20
26
|
declare function withTimeout<T>(run: () => Promise<T>, ms: number): Promise<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])
|
|
1
|
+
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
2
2
|
function getWords(str) {
|
|
3
3
|
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
4
4
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace'
|
|
13
13
|
* const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'
|
|
14
14
|
* const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'
|
|
15
|
+
* const convertedStr5 = camelCase('Keep unicode 😅') // returns 'keepUnicode😅'
|
|
15
16
|
*/
|
|
16
17
|
declare function camelCase(str: string): string;
|
|
17
18
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace'
|
|
13
13
|
* const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'
|
|
14
14
|
* const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'
|
|
15
|
+
* const convertedStr5 = camelCase('Keep unicode 😅') // returns 'keepUnicode😅'
|
|
15
16
|
*/
|
|
16
17
|
declare function camelCase(str: string): string;
|
|
17
18
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to constant case.
|
|
3
|
+
*
|
|
4
|
+
* Constant case is a naming convention where each word is written in uppercase letters and separated by an underscore (`_`). For example, `CONSTANT_CASE`.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} str - The string that is to be changed to constant case.
|
|
7
|
+
* @returns {string} - The converted string to constant case.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const convertedStr1 = constantCase('camelCase') // returns 'CAMEL_CASE'
|
|
11
|
+
* const convertedStr2 = constantCase('some whitespace') // returns 'SOME_WHITESPACE'
|
|
12
|
+
* const convertedStr3 = constantCase('hyphen-text') // returns 'HYPHEN_TEXT'
|
|
13
|
+
* const convertedStr4 = constantCase('HTTPRequest') // returns 'HTTP_REQUEST'
|
|
14
|
+
*/
|
|
15
|
+
declare function constantCase(str: string): string;
|
|
16
|
+
|
|
17
|
+
export { constantCase };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to constant case.
|
|
3
|
+
*
|
|
4
|
+
* Constant case is a naming convention where each word is written in uppercase letters and separated by an underscore (`_`). For example, `CONSTANT_CASE`.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} str - The string that is to be changed to constant case.
|
|
7
|
+
* @returns {string} - The converted string to constant case.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const convertedStr1 = constantCase('camelCase') // returns 'CAMEL_CASE'
|
|
11
|
+
* const convertedStr2 = constantCase('some whitespace') // returns 'SOME_WHITESPACE'
|
|
12
|
+
* const convertedStr3 = constantCase('hyphen-text') // returns 'HYPHEN_TEXT'
|
|
13
|
+
* const convertedStr4 = constantCase('HTTPRequest') // returns 'HTTP_REQUEST'
|
|
14
|
+
*/
|
|
15
|
+
declare function constantCase(str: string): string;
|
|
16
|
+
|
|
17
|
+
export { constantCase };
|
package/dist/string/index.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ export { lowerCase } from './lowerCase.mjs';
|
|
|
6
6
|
export { startCase } from './startCase.mjs';
|
|
7
7
|
export { capitalize } from './capitalize.mjs';
|
|
8
8
|
export { pascalCase } from './pascalCase.mjs';
|
|
9
|
+
export { constantCase } from './constantCase.mjs';
|
|
9
10
|
export { trim } from './trim.mjs';
|
|
10
11
|
export { trimStart } from './trimStart.mjs';
|
|
11
12
|
export { trimEnd } from './trimEnd.mjs';
|
package/dist/string/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { lowerCase } from './lowerCase.js';
|
|
|
6
6
|
export { startCase } from './startCase.js';
|
|
7
7
|
export { capitalize } from './capitalize.js';
|
|
8
8
|
export { pascalCase } from './pascalCase.js';
|
|
9
|
+
export { constantCase } from './constantCase.js';
|
|
9
10
|
export { trim } from './trim.js';
|
|
10
11
|
export { trimStart } from './trimStart.js';
|
|
11
12
|
export { trimEnd } from './trimEnd.js';
|
package/dist/string/index.js
CHANGED
|
@@ -6,7 +6,7 @@ function capitalize(str) {
|
|
|
6
6
|
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])
|
|
9
|
+
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
10
10
|
function getWords(str) {
|
|
11
11
|
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
12
12
|
}
|
|
@@ -50,16 +50,12 @@ function lowerCase(str) {
|
|
|
50
50
|
function startCase(str) {
|
|
51
51
|
const words = getWords(str.trim());
|
|
52
52
|
let result = '';
|
|
53
|
-
for (
|
|
53
|
+
for (let i = 0; i < words.length; i++) {
|
|
54
|
+
const word = words[i];
|
|
54
55
|
if (result) {
|
|
55
56
|
result += ' ';
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
result += word;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
62
|
-
}
|
|
58
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
63
59
|
}
|
|
64
60
|
return result;
|
|
65
61
|
}
|
|
@@ -69,6 +65,11 @@ function pascalCase(str) {
|
|
|
69
65
|
return words.map(word => capitalize(word)).join('');
|
|
70
66
|
}
|
|
71
67
|
|
|
68
|
+
function constantCase(str) {
|
|
69
|
+
const words = getWords(str);
|
|
70
|
+
return words.map(word => word.toUpperCase()).join('_');
|
|
71
|
+
}
|
|
72
|
+
|
|
72
73
|
function trimStart(str, chars) {
|
|
73
74
|
if (chars === undefined) {
|
|
74
75
|
return str.trimStart();
|
|
@@ -202,6 +203,7 @@ function pad(str, length, chars = ' ') {
|
|
|
202
203
|
|
|
203
204
|
exports.camelCase = camelCase;
|
|
204
205
|
exports.capitalize = capitalize;
|
|
206
|
+
exports.constantCase = constantCase;
|
|
205
207
|
exports.deburr = deburr;
|
|
206
208
|
exports.escape = escape;
|
|
207
209
|
exports.escapeRegExp = escapeRegExp;
|
package/dist/string/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ export { lowerCase } from './lowerCase.mjs';
|
|
|
6
6
|
export { startCase } from './startCase.mjs';
|
|
7
7
|
export { capitalize } from './capitalize.mjs';
|
|
8
8
|
export { pascalCase } from './pascalCase.mjs';
|
|
9
|
+
export { constantCase } from './constantCase.mjs';
|
|
9
10
|
export { trim } from './trim.mjs';
|
|
10
11
|
export { trimStart } from './trimStart.mjs';
|
|
11
12
|
export { trimEnd } from './trimEnd.mjs';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* const result1 = startCase('hello world'); // result will be 'Hello World'
|
|
10
|
-
* const result2 = startCase('HELLO WORLD'); // result will be '
|
|
10
|
+
* const result2 = startCase('HELLO WORLD'); // result will be 'Hello World'
|
|
11
11
|
* const result3 = startCase('hello-world'); // result will be 'Hello World'
|
|
12
12
|
* const result4 = startCase('hello_world'); // result will be 'Hello World'
|
|
13
13
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* const result1 = startCase('hello world'); // result will be 'Hello World'
|
|
10
|
-
* const result2 = startCase('HELLO WORLD'); // result will be '
|
|
10
|
+
* const result2 = startCase('HELLO WORLD'); // result will be 'Hello World'
|
|
11
11
|
* const result3 = startCase('hello-world'); // result will be 'Hello World'
|
|
12
12
|
* const result4 = startCase('hello_world'); // result will be 'Hello World'
|
|
13
13
|
*/
|
|
@@ -3,16 +3,12 @@ import { getWords } from './_internal/getWords.mjs';
|
|
|
3
3
|
function startCase(str) {
|
|
4
4
|
const words = getWords(str.trim());
|
|
5
5
|
let result = '';
|
|
6
|
-
for (
|
|
6
|
+
for (let i = 0; i < words.length; i++) {
|
|
7
|
+
const word = words[i];
|
|
7
8
|
if (result) {
|
|
8
9
|
result += ' ';
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
result += word;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
15
|
-
}
|
|
11
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
16
12
|
}
|
|
17
13
|
return result;
|
|
18
14
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Removes leading whitespace or specified characters from a string.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} str - The string from which leading characters will be trimmed.
|
|
5
|
-
* @param {string | string[]} chars - The character(s) to remove from the
|
|
5
|
+
* @param {string | string[]} chars - The character(s) to remove from the start of the string.
|
|
6
6
|
* @returns {string} - The resulting string after the specified leading character has been removed.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Removes leading whitespace or specified characters from a string.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} str - The string from which leading characters will be trimmed.
|
|
5
|
-
* @param {string | string[]} chars - The character(s) to remove from the
|
|
5
|
+
* @param {string | string[]} chars - The character(s) to remove from the start of the string.
|
|
6
6
|
* @returns {string} - The resulting string after the specified leading character has been removed.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @returns {string} - The converted string.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* const convertedStr1 =
|
|
9
|
-
* const convertedStr2 =
|
|
10
|
-
* const convertedStr3 =
|
|
8
|
+
* const convertedStr1 = upperFirst('fred') // returns 'Fred'
|
|
9
|
+
* const convertedStr2 = upperFirst('Fred') // returns 'Fred'
|
|
10
|
+
* const convertedStr3 = upperFirst('FRED') // returns 'FRED'
|
|
11
11
|
*/
|
|
12
12
|
declare function upperFirst(str: string): string;
|
|
13
13
|
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @returns {string} - The converted string.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* const convertedStr1 =
|
|
9
|
-
* const convertedStr2 =
|
|
10
|
-
* const convertedStr3 =
|
|
8
|
+
* const convertedStr1 = upperFirst('fred') // returns 'Fred'
|
|
9
|
+
* const convertedStr2 = upperFirst('Fred') // returns 'Fred'
|
|
10
|
+
* const convertedStr3 = upperFirst('FRED') // returns 'FRED'
|
|
11
11
|
*/
|
|
12
12
|
declare function upperFirst(str: string): string;
|
|
13
13
|
|
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
|
+
"version": "1.21.0-dev.660+d2164703",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
|
@@ -228,6 +228,7 @@
|
|
|
228
228
|
"eslint": "^9.9.0",
|
|
229
229
|
"eslint-config-prettier": "^9.1.0",
|
|
230
230
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
231
|
+
"eslint-plugin-no-for-of-array": "^0.0.1",
|
|
231
232
|
"eslint-plugin-vue": "^9.28.0",
|
|
232
233
|
"execa": "^9.3.0",
|
|
233
234
|
"globals": "^15.9.0",
|