es-toolkit 1.22.0-dev.698 → 1.22.0-dev.700
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/_chunk/{isWeakSet-DDVaWr.js → isWeakSet-CsTXLi.js} +17 -12
- package/dist/_chunk/{toMerged-DD-s3X.js → toMerged-QkD_NC.js} +1 -1
- 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 +5 -4
- package/dist/compat/index.mjs +1 -0
- package/dist/compat/math/random.mjs +1 -1
- package/dist/compat/object/has.mjs +1 -1
- package/dist/compat/object/mapKeys.mjs +1 -1
- package/dist/compat/object/mapValues.mjs +1 -1
- package/dist/compat/object/merge.mjs +1 -1
- package/dist/compat/object/mergeWith.mjs +1 -1
- package/dist/compat/object/omit.mjs +1 -1
- package/dist/compat/object/pick.mjs +1 -1
- package/dist/compat/object/unset.mjs +1 -1
- package/dist/compat/predicate/isMatch.mjs +1 -1
- package/dist/compat/predicate/matches.mjs +1 -1
- package/dist/compat/predicate/matchesProperty.mjs +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -4
- package/dist/index.mjs +1 -0
- package/dist/object/clone.mjs +1 -1
- package/dist/object/index.js +1 -1
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +3 -2
- package/dist/predicate/index.mjs +1 -0
- package/dist/predicate/isArrayBuffer.d.mts +20 -0
- package/dist/predicate/isArrayBuffer.d.ts +20 -0
- package/dist/predicate/isArrayBuffer.mjs +5 -0
- package/dist/predicate/isEqual.mjs +2 -2
- package/dist/string/camelCase.mjs +1 -1
- package/dist/string/index.js +1 -1
- package/dist/string/trim.mjs +1 -1
- package/package.json +9 -1
- package/dist/_chunk/{isPlainObject-DKBeLp.js → isPlainObject-DgrsU7.js} +4 -4
- package/dist/_chunk/{pad-Cw2pvt.js → pad-v_6EEn.js} +20 -20
package/dist/compat/index.d.mts
CHANGED
|
@@ -71,6 +71,7 @@ export { invert } from '../object/invert.mjs';
|
|
|
71
71
|
export { clone } from '../object/clone.mjs';
|
|
72
72
|
export { flattenObject } from '../object/flattenObject.mjs';
|
|
73
73
|
export { toMerged } from '../object/toMerged.mjs';
|
|
74
|
+
export { isArrayBuffer } from '../predicate/isArrayBuffer.mjs';
|
|
74
75
|
export { isDate } from '../predicate/isDate.mjs';
|
|
75
76
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
76
77
|
export { isMap } from '../predicate/isMap.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export { invert } from '../object/invert.js';
|
|
|
71
71
|
export { clone } from '../object/clone.js';
|
|
72
72
|
export { flattenObject } from '../object/flattenObject.js';
|
|
73
73
|
export { toMerged } from '../object/toMerged.js';
|
|
74
|
+
export { isArrayBuffer } from '../predicate/isArrayBuffer.js';
|
|
74
75
|
export { isDate } from '../predicate/isDate.js';
|
|
75
76
|
export { isEqual } from '../predicate/isEqual.js';
|
|
76
77
|
export { isMap } from '../predicate/isMap.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -7,10 +7,10 @@ const promise_index = require('../_chunk/index-BGZDR9.js');
|
|
|
7
7
|
const flowRight = require('../_chunk/flowRight-DD5Qyk.js');
|
|
8
8
|
const range = require('../_chunk/range-BXlMmn.js');
|
|
9
9
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
10
|
-
const toMerged = require('../_chunk/toMerged-
|
|
11
|
-
const isPlainObject$1 = require('../_chunk/isPlainObject-
|
|
12
|
-
const isWeakSet$1 = require('../_chunk/isWeakSet-
|
|
13
|
-
const pad$1 = require('../_chunk/pad-
|
|
10
|
+
const toMerged = require('../_chunk/toMerged-QkD_NC.js');
|
|
11
|
+
const isPlainObject$1 = require('../_chunk/isPlainObject-DgrsU7.js');
|
|
12
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-CsTXLi.js');
|
|
13
|
+
const pad$1 = require('../_chunk/pad-v_6EEn.js');
|
|
14
14
|
|
|
15
15
|
function castArray(value) {
|
|
16
16
|
if (arguments.length === 0) {
|
|
@@ -1871,6 +1871,7 @@ exports.omitBy = toMerged.omitBy;
|
|
|
1871
1871
|
exports.pickBy = toMerged.pickBy;
|
|
1872
1872
|
exports.toMerged = toMerged.toMerged;
|
|
1873
1873
|
exports.isPrimitive = isPlainObject$1.isPrimitive;
|
|
1874
|
+
exports.isArrayBuffer = isWeakSet$1.isArrayBuffer;
|
|
1874
1875
|
exports.isDate = isWeakSet$1.isDate;
|
|
1875
1876
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
1876
1877
|
exports.isFunction = isWeakSet$1.isFunction;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -73,6 +73,7 @@ export { flattenObject } from '../object/flattenObject.mjs';
|
|
|
73
73
|
export { isPrimitive } from '../predicate/isPrimitive.mjs';
|
|
74
74
|
export { isObjectLike } from './predicate/isObjectLike.mjs';
|
|
75
75
|
export { toMerged } from '../object/toMerged.mjs';
|
|
76
|
+
export { isArrayBuffer } from '../predicate/isArrayBuffer.mjs';
|
|
76
77
|
export { isDate } from '../predicate/isDate.mjs';
|
|
77
78
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
78
79
|
export { isMap } from '../predicate/isMap.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDeepKey } from '../_internal/isDeepKey.mjs';
|
|
2
2
|
import { isIndex } from '../_internal/isIndex.mjs';
|
|
3
|
-
import { toPath } from '../util/toPath.mjs';
|
|
4
3
|
import { isArguments } from '../predicate/isArguments.mjs';
|
|
4
|
+
import { toPath } from '../util/toPath.mjs';
|
|
5
5
|
|
|
6
6
|
function has(object, path) {
|
|
7
7
|
let resolvedPath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { property } from './property.mjs';
|
|
1
2
|
import { mapKeys as mapKeys$1 } from '../../object/mapKeys.mjs';
|
|
2
3
|
import { identity } from '../_internal/identity.mjs';
|
|
3
|
-
import { property } from './property.mjs';
|
|
4
4
|
|
|
5
5
|
function mapKeys(object, getNewKey) {
|
|
6
6
|
getNewKey = getNewKey ?? identity;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { property } from './property.mjs';
|
|
1
2
|
import { mapValues as mapValues$1 } from '../../object/mapValues.mjs';
|
|
2
3
|
import { identity } from '../_internal/identity.mjs';
|
|
3
|
-
import { property } from './property.mjs';
|
|
4
4
|
|
|
5
5
|
function mapValues(object, getNewValue) {
|
|
6
6
|
getNewValue = getNewValue ?? identity;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { cloneDeep } from './cloneDeep.mjs';
|
|
1
2
|
import { clone } from '../../object/clone.mjs';
|
|
2
3
|
import { getSymbols } from '../_internal/getSymbols.mjs';
|
|
3
4
|
import { isArguments } from '../predicate/isArguments.mjs';
|
|
4
5
|
import { isObjectLike } from '../predicate/isObjectLike.mjs';
|
|
5
6
|
import { isPlainObject } from '../predicate/isPlainObject.mjs';
|
|
6
7
|
import { isTypedArray } from '../predicate/isTypedArray.mjs';
|
|
7
|
-
import { cloneDeep } from './cloneDeep.mjs';
|
|
8
8
|
|
|
9
9
|
function mergeWith(object, ...otherArgs) {
|
|
10
10
|
const sources = otherArgs.slice(0, -1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { get } from './get.mjs';
|
|
1
2
|
import { isDeepKey } from '../_internal/isDeepKey.mjs';
|
|
2
3
|
import { toKey } from '../_internal/toKey.mjs';
|
|
3
4
|
import { toPath } from '../util/toPath.mjs';
|
|
4
|
-
import { get } from './get.mjs';
|
|
5
5
|
|
|
6
6
|
function unset(obj, path) {
|
|
7
7
|
if (obj == null) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { isMatch } from './isMatch.mjs';
|
|
1
2
|
import { toKey } from '../_internal/toKey.mjs';
|
|
2
3
|
import { cloneDeep } from '../object/cloneDeep.mjs';
|
|
3
4
|
import { get } from '../object/get.mjs';
|
|
4
5
|
import { has } from '../object/has.mjs';
|
|
5
|
-
import { isMatch } from './isMatch.mjs';
|
|
6
6
|
|
|
7
7
|
function matchesProperty(property, source) {
|
|
8
8
|
switch (typeof property) {
|
package/dist/index.d.mts
CHANGED
|
@@ -97,6 +97,7 @@ export { cloneDeep } from './object/cloneDeep.mjs';
|
|
|
97
97
|
export { merge } from './object/merge.mjs';
|
|
98
98
|
export { toMerged } from './object/toMerged.mjs';
|
|
99
99
|
export { mergeWith } from './object/mergeWith.mjs';
|
|
100
|
+
export { isArrayBuffer } from './predicate/isArrayBuffer.mjs';
|
|
100
101
|
export { isDate } from './predicate/isDate.mjs';
|
|
101
102
|
export { isEqual } from './predicate/isEqual.mjs';
|
|
102
103
|
export { isError } from './predicate/isError.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ export { cloneDeep } from './object/cloneDeep.js';
|
|
|
97
97
|
export { merge } from './object/merge.js';
|
|
98
98
|
export { toMerged } from './object/toMerged.js';
|
|
99
99
|
export { mergeWith } from './object/mergeWith.js';
|
|
100
|
+
export { isArrayBuffer } from './predicate/isArrayBuffer.js';
|
|
100
101
|
export { isDate } from './predicate/isDate.js';
|
|
101
102
|
export { isEqual } from './predicate/isEqual.js';
|
|
102
103
|
export { isError } from './predicate/isError.js';
|
package/dist/index.js
CHANGED
|
@@ -11,11 +11,11 @@ const range = require('./_chunk/range-BXlMmn.js');
|
|
|
11
11
|
const randomInt = require('./_chunk/randomInt-CF7bZK.js');
|
|
12
12
|
const math_index = require('./math/index.js');
|
|
13
13
|
const object_index = require('./object/index.js');
|
|
14
|
-
const toMerged = require('./_chunk/toMerged-
|
|
15
|
-
const isWeakSet = require('./_chunk/isWeakSet-
|
|
14
|
+
const toMerged = require('./_chunk/toMerged-QkD_NC.js');
|
|
15
|
+
const isWeakSet = require('./_chunk/isWeakSet-CsTXLi.js');
|
|
16
16
|
const predicate_index = require('./predicate/index.js');
|
|
17
|
-
const isPlainObject = require('./_chunk/isPlainObject-
|
|
18
|
-
const pad = require('./_chunk/pad-
|
|
17
|
+
const isPlainObject = require('./_chunk/isPlainObject-DgrsU7.js');
|
|
18
|
+
const pad = require('./_chunk/pad-v_6EEn.js');
|
|
19
19
|
const string_index = require('./string/index.js');
|
|
20
20
|
|
|
21
21
|
|
|
@@ -122,6 +122,7 @@ exports.merge = toMerged.merge;
|
|
|
122
122
|
exports.omitBy = toMerged.omitBy;
|
|
123
123
|
exports.pickBy = toMerged.pickBy;
|
|
124
124
|
exports.toMerged = toMerged.toMerged;
|
|
125
|
+
exports.isArrayBuffer = isWeakSet.isArrayBuffer;
|
|
125
126
|
exports.isDate = isWeakSet.isDate;
|
|
126
127
|
exports.isEqual = isWeakSet.isEqual;
|
|
127
128
|
exports.isFunction = isWeakSet.isFunction;
|
package/dist/index.mjs
CHANGED
|
@@ -97,6 +97,7 @@ export { cloneDeep } from './object/cloneDeep.mjs';
|
|
|
97
97
|
export { merge } from './object/merge.mjs';
|
|
98
98
|
export { toMerged } from './object/toMerged.mjs';
|
|
99
99
|
export { mergeWith } from './object/mergeWith.mjs';
|
|
100
|
+
export { isArrayBuffer } from './predicate/isArrayBuffer.mjs';
|
|
100
101
|
export { isDate } from './predicate/isDate.mjs';
|
|
101
102
|
export { isEqual } from './predicate/isEqual.mjs';
|
|
102
103
|
export { isError } from './predicate/isError.mjs';
|
package/dist/object/clone.mjs
CHANGED
package/dist/object/index.js
CHANGED
package/dist/predicate/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const isWeakSet = require('../_chunk/isWeakSet-
|
|
6
|
-
const isPlainObject = require('../_chunk/isPlainObject-
|
|
5
|
+
const isWeakSet = require('../_chunk/isWeakSet-CsTXLi.js');
|
|
6
|
+
const isPlainObject = require('../_chunk/isPlainObject-DgrsU7.js');
|
|
7
7
|
|
|
8
8
|
function isError(value) {
|
|
9
9
|
return value instanceof Error;
|
|
@@ -21,6 +21,7 @@ function isString(value) {
|
|
|
21
21
|
return typeof value === 'string';
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
exports.isArrayBuffer = isWeakSet.isArrayBuffer;
|
|
24
25
|
exports.isDate = isWeakSet.isDate;
|
|
25
26
|
exports.isEqual = isWeakSet.isEqual;
|
|
26
27
|
exports.isFunction = isWeakSet.isFunction;
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given value is `ArrayBuffer`.
|
|
3
|
+
*
|
|
4
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `ArrayBuffer`.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} value The value to check if it is a `ArrayBuffer`.
|
|
7
|
+
* @returns {value is ArrayBuffer} Returns `true` if `value` is a `ArrayBuffer`, else `false`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const value1 = new ArrayBuffer();
|
|
11
|
+
* const value2 = new Array();
|
|
12
|
+
* const value3 = new Map();
|
|
13
|
+
*
|
|
14
|
+
* console.log(isArrayBuffer(value1)); // true
|
|
15
|
+
* console.log(isArrayBuffer(value2)); // false
|
|
16
|
+
* console.log(isArrayBuffer(value3)); // false
|
|
17
|
+
*/
|
|
18
|
+
declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
|
|
19
|
+
|
|
20
|
+
export { isArrayBuffer };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given value is `ArrayBuffer`.
|
|
3
|
+
*
|
|
4
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `ArrayBuffer`.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} value The value to check if it is a `ArrayBuffer`.
|
|
7
|
+
* @returns {value is ArrayBuffer} Returns `true` if `value` is a `ArrayBuffer`, else `false`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const value1 = new ArrayBuffer();
|
|
11
|
+
* const value2 = new Array();
|
|
12
|
+
* const value3 = new Map();
|
|
13
|
+
*
|
|
14
|
+
* console.log(isArrayBuffer(value1)); // true
|
|
15
|
+
* console.log(isArrayBuffer(value2)); // false
|
|
16
|
+
* console.log(isArrayBuffer(value3)); // false
|
|
17
|
+
*/
|
|
18
|
+
declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
|
|
19
|
+
|
|
20
|
+
export { isArrayBuffer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isPlainObject } from './isPlainObject.mjs';
|
|
2
2
|
import { getSymbols } from '../compat/_internal/getSymbols.mjs';
|
|
3
3
|
import { getTag } from '../compat/_internal/getTag.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { functionTag, regexpTag, symbolTag, dateTag, booleanTag, numberTag, stringTag, objectTag, errorTag, dataViewTag, arrayBufferTag, float64ArrayTag, float32ArrayTag, bigInt64ArrayTag, int32ArrayTag, int16ArrayTag, int8ArrayTag, bigUint64ArrayTag, uint32ArrayTag, uint16ArrayTag, uint8ClampedArrayTag, uint8ArrayTag, arrayTag, setTag, mapTag, argumentsTag } from '../compat/_internal/tags.mjs';
|
|
5
5
|
|
|
6
6
|
function isEqual(a, b) {
|
|
7
7
|
if (typeof a === typeof b) {
|
package/dist/string/index.js
CHANGED
package/dist/string/trim.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.22.0-dev.
|
|
4
|
+
"version": "1.22.0-dev.700+23aa7db5",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
|
@@ -218,17 +218,20 @@
|
|
|
218
218
|
"@eslint/js": "^9.9.0",
|
|
219
219
|
"@rollup/plugin-terser": "^0.4.4",
|
|
220
220
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
221
|
+
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
221
222
|
"@types/broken-link-checker": "^0",
|
|
222
223
|
"@types/eslint": "^9",
|
|
223
224
|
"@types/jscodeshift": "^0.11.11",
|
|
224
225
|
"@types/node": "^20.12.11",
|
|
225
226
|
"@types/tar": "^6.1.13",
|
|
226
227
|
"@vitest/coverage-istanbul": "^1.5.2",
|
|
228
|
+
"@vue/compiler-sfc": "^3.5.10",
|
|
227
229
|
"broken-link-checker": "^0.7.8",
|
|
228
230
|
"eslint": "^9.9.0",
|
|
229
231
|
"eslint-config-prettier": "^9.1.0",
|
|
230
232
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
231
233
|
"eslint-plugin-no-for-of-array": "^0.0.1",
|
|
234
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
232
235
|
"eslint-plugin-vue": "^9.28.0",
|
|
233
236
|
"execa": "^9.3.0",
|
|
234
237
|
"globals": "^15.9.0",
|
|
@@ -243,6 +246,11 @@
|
|
|
243
246
|
"typescript-eslint": "^8.1.0",
|
|
244
247
|
"vitest": "^1.5.2"
|
|
245
248
|
},
|
|
249
|
+
"dependenciesMeta": {
|
|
250
|
+
"@trivago/prettier-plugin-sort-imports@4.3.0": {
|
|
251
|
+
"unplugged": true
|
|
252
|
+
}
|
|
253
|
+
},
|
|
246
254
|
"sideEffects": false,
|
|
247
255
|
"scripts": {
|
|
248
256
|
"prepack": "yarn build",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function isTypedArray(x) {
|
|
4
|
-
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
function isPrimitive(value) {
|
|
8
4
|
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
9
5
|
}
|
|
10
6
|
|
|
7
|
+
function isTypedArray(x) {
|
|
8
|
+
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
11
|
function isPlainObject(value) {
|
|
12
12
|
if (typeof value !== 'object') {
|
|
13
13
|
return false;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function capitalize(str) {
|
|
4
|
-
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
8
4
|
function getWords(str) {
|
|
9
5
|
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
10
6
|
}
|
|
11
7
|
|
|
8
|
+
function capitalize(str) {
|
|
9
|
+
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
|
10
|
+
}
|
|
11
|
+
|
|
12
12
|
function camelCase(str) {
|
|
13
13
|
const words = getWords(str);
|
|
14
14
|
if (words.length === 0) {
|
|
@@ -55,46 +55,46 @@ function constantCase(str) {
|
|
|
55
55
|
return words.map(word => word.toUpperCase()).join('_');
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function
|
|
58
|
+
function trimEnd(str, chars) {
|
|
59
59
|
if (chars === undefined) {
|
|
60
|
-
return str.
|
|
60
|
+
return str.trimEnd();
|
|
61
61
|
}
|
|
62
|
-
let
|
|
62
|
+
let endIndex = str.length;
|
|
63
63
|
switch (typeof chars) {
|
|
64
64
|
case 'string': {
|
|
65
|
-
while (
|
|
66
|
-
|
|
65
|
+
while (endIndex > 0 && str[endIndex - 1] === chars) {
|
|
66
|
+
endIndex--;
|
|
67
67
|
}
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
70
|
case 'object': {
|
|
71
|
-
while (
|
|
72
|
-
|
|
71
|
+
while (endIndex > 0 && chars.includes(str[endIndex - 1])) {
|
|
72
|
+
endIndex--;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
return str.substring(
|
|
76
|
+
return str.substring(0, endIndex);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function
|
|
79
|
+
function trimStart(str, chars) {
|
|
80
80
|
if (chars === undefined) {
|
|
81
|
-
return str.
|
|
81
|
+
return str.trimStart();
|
|
82
82
|
}
|
|
83
|
-
let
|
|
83
|
+
let startIndex = 0;
|
|
84
84
|
switch (typeof chars) {
|
|
85
85
|
case 'string': {
|
|
86
|
-
while (
|
|
87
|
-
|
|
86
|
+
while (startIndex < str.length && str[startIndex] === chars) {
|
|
87
|
+
startIndex++;
|
|
88
88
|
}
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
case 'object': {
|
|
92
|
-
while (
|
|
93
|
-
|
|
92
|
+
while (startIndex < str.length && chars.includes(str[startIndex])) {
|
|
93
|
+
startIndex++;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
return str.substring(
|
|
97
|
+
return str.substring(startIndex);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
function trim(str, chars) {
|