es-toolkit 1.22.0-dev.699 → 1.22.0-dev.701

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 (37) hide show
  1. package/dist/_chunk/{isWeakSet-CGakJk.js → isWeakSet-CsTXLi.js} +12 -12
  2. package/dist/_chunk/{toMerged-DD-s3X.js → toMerged-QkD_NC.js} +1 -1
  3. package/dist/browser.global.js +1 -1
  4. package/dist/browser.global.js.map +1 -1
  5. package/dist/compat/function/flow.d.mts +133 -0
  6. package/dist/compat/function/flow.d.ts +133 -0
  7. package/dist/compat/function/flow.mjs +12 -0
  8. package/dist/compat/function/flowRight.d.mts +145 -0
  9. package/dist/compat/function/flowRight.d.ts +145 -0
  10. package/dist/compat/function/flowRight.mjs +12 -0
  11. package/dist/compat/index.d.mts +2 -2
  12. package/dist/compat/index.d.ts +2 -2
  13. package/dist/compat/index.js +37 -21
  14. package/dist/compat/index.mjs +2 -2
  15. package/dist/compat/math/random.mjs +1 -1
  16. package/dist/compat/object/has.mjs +1 -1
  17. package/dist/compat/object/mapKeys.mjs +1 -1
  18. package/dist/compat/object/mapValues.mjs +1 -1
  19. package/dist/compat/object/merge.mjs +1 -1
  20. package/dist/compat/object/mergeWith.mjs +1 -1
  21. package/dist/compat/object/omit.mjs +1 -1
  22. package/dist/compat/object/pick.mjs +1 -1
  23. package/dist/compat/object/unset.mjs +1 -1
  24. package/dist/compat/predicate/isMatch.mjs +1 -1
  25. package/dist/compat/predicate/matches.mjs +1 -1
  26. package/dist/compat/predicate/matchesProperty.mjs +1 -1
  27. package/dist/index.js +4 -4
  28. package/dist/object/clone.mjs +1 -1
  29. package/dist/object/index.js +1 -1
  30. package/dist/predicate/index.js +2 -2
  31. package/dist/predicate/isEqual.mjs +2 -2
  32. package/dist/string/camelCase.mjs +1 -1
  33. package/dist/string/index.js +1 -1
  34. package/dist/string/trim.mjs +1 -1
  35. package/package.json +9 -1
  36. package/dist/_chunk/{isPlainObject-DKBeLp.js → isPlainObject-DgrsU7.js} +4 -4
  37. package/dist/_chunk/{pad-Cw2pvt.js → pad-v_6EEn.js} +20 -20
@@ -4,13 +4,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const zipWith = require('../_chunk/zipWith-EOU_KZ.js');
6
6
  const promise_index = require('../_chunk/index-BGZDR9.js');
7
- const flowRight = require('../_chunk/flowRight-DD5Qyk.js');
7
+ const flowRight$1 = 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-DD-s3X.js');
11
- const isPlainObject$1 = require('../_chunk/isPlainObject-DKBeLp.js');
12
- const isWeakSet$1 = require('../_chunk/isWeakSet-CGakJk.js');
13
- const pad$1 = require('../_chunk/pad-Cw2pvt.js');
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) {
@@ -905,7 +905,7 @@ function ary(func, n = func.length, guard) {
905
905
  if (Number.isNaN(n) || n < 0) {
906
906
  n = 0;
907
907
  }
908
- return flowRight.ary(func, n);
908
+ return flowRight$1.ary(func, n);
909
909
  }
910
910
 
911
911
  function bind(func, thisObj, ...partialArgs) {
@@ -972,7 +972,7 @@ function rest(func, start = func.length - 1) {
972
972
  if (Number.isNaN(start) || start < 0) {
973
973
  start = func.length - 1;
974
974
  }
975
- return flowRight.rest(func, start);
975
+ return flowRight$1.rest(func, start);
976
976
  }
977
977
 
978
978
  function spread(func, argsIndex = 0) {
@@ -1080,7 +1080,7 @@ function debounce(func, debounceMs = 0, options = {}) {
1080
1080
  }
1081
1081
  let result = undefined;
1082
1082
  let pendingAt = null;
1083
- const _debounced = flowRight.debounce(function (...args) {
1083
+ const _debounced = flowRight$1.debounce(function (...args) {
1084
1084
  result = func.apply(this, args);
1085
1085
  pendingAt = null;
1086
1086
  }, debounceMs, { signal, edges });
@@ -1125,6 +1125,22 @@ function flip(func) {
1125
1125
  };
1126
1126
  }
1127
1127
 
1128
+ function flow(...funcs) {
1129
+ const flattenFuncs = zipWith.flatten(funcs, 1);
1130
+ if (flattenFuncs.some(func => typeof func !== 'function')) {
1131
+ throw new TypeError('Expected a function');
1132
+ }
1133
+ return flowRight$1.flow(...flattenFuncs);
1134
+ }
1135
+
1136
+ function flowRight(...funcs) {
1137
+ const flattenFuncs = zipWith.flatten(funcs, 1);
1138
+ if (flattenFuncs.some(func => typeof func !== 'function')) {
1139
+ throw new TypeError('Expected a function');
1140
+ }
1141
+ return flowRight$1.flowRight(...flattenFuncs);
1142
+ }
1143
+
1128
1144
  function isNil(x) {
1129
1145
  return x == null;
1130
1146
  }
@@ -1392,7 +1408,7 @@ function mergeWithDeep(target, source, merge, stack) {
1392
1408
  }
1393
1409
 
1394
1410
  function merge(object, ...sources) {
1395
- return mergeWith(object, ...sources, flowRight.noop);
1411
+ return mergeWith(object, ...sources, flowRight$1.noop);
1396
1412
  }
1397
1413
 
1398
1414
  function isArrayLike(value) {
@@ -1845,18 +1861,16 @@ exports.TimeoutError = promise_index.TimeoutError;
1845
1861
  exports.delay = promise_index.delay;
1846
1862
  exports.timeout = promise_index.timeout;
1847
1863
  exports.withTimeout = promise_index.withTimeout;
1848
- exports.after = flowRight.after;
1849
- exports.before = flowRight.before;
1850
- exports.curryRight = flowRight.curryRight;
1851
- exports.flow = flowRight.flow;
1852
- exports.flowRight = flowRight.flowRight;
1853
- exports.memoize = flowRight.memoize;
1854
- exports.negate = flowRight.negate;
1855
- exports.noop = flowRight.noop;
1856
- exports.once = flowRight.once;
1857
- exports.partial = flowRight.partial;
1858
- exports.partialRight = flowRight.partialRight;
1859
- exports.unary = flowRight.unary;
1864
+ exports.after = flowRight$1.after;
1865
+ exports.before = flowRight$1.before;
1866
+ exports.curryRight = flowRight$1.curryRight;
1867
+ exports.memoize = flowRight$1.memoize;
1868
+ exports.negate = flowRight$1.negate;
1869
+ exports.noop = flowRight$1.noop;
1870
+ exports.once = flowRight$1.once;
1871
+ exports.partial = flowRight$1.partial;
1872
+ exports.partialRight = flowRight$1.partialRight;
1873
+ exports.unary = flowRight$1.unary;
1860
1874
  exports.mean = range.mean;
1861
1875
  exports.meanBy = range.meanBy;
1862
1876
  exports.range = range.range;
@@ -1924,6 +1938,8 @@ exports.flattenDeep = flattenDeep;
1924
1938
  exports.flattenDepth = flattenDepth;
1925
1939
  exports.flip = flip;
1926
1940
  exports.floor = floor;
1941
+ exports.flow = flow;
1942
+ exports.flowRight = flowRight;
1927
1943
  exports.fromPairs = fromPairs;
1928
1944
  exports.get = get;
1929
1945
  exports.has = has;
@@ -57,8 +57,6 @@ export { unary } from '../function/unary.mjs';
57
57
  export { partial } from '../function/partial.mjs';
58
58
  export { partialRight } from '../function/partialRight.mjs';
59
59
  export { curryRight } from '../function/curryRight.mjs';
60
- export { flow } from '../function/flow.mjs';
61
- export { flowRight } from '../function/flowRight.mjs';
62
60
  export { mean } from '../math/mean.mjs';
63
61
  export { meanBy } from '../math/meanBy.mjs';
64
62
  export { randomInt } from '../math/randomInt.mjs';
@@ -133,6 +131,8 @@ export { curry } from './function/curry.mjs';
133
131
  export { debounce } from './function/debounce.mjs';
134
132
  export { throttle } from './function/throttle.mjs';
135
133
  export { flip } from './function/flip.mjs';
134
+ export { flow } from './function/flow.mjs';
135
+ export { flowRight } from './function/flowRight.mjs';
136
136
  export { get } from './object/get.mjs';
137
137
  export { set } from './object/set.mjs';
138
138
  export { pick } from './object/pick.mjs';
@@ -1,6 +1,6 @@
1
+ import { clamp } from './clamp.mjs';
1
2
  import { random as random$1 } from '../../math/random.mjs';
2
3
  import { randomInt } from '../../math/randomInt.mjs';
3
- import { clamp } from './clamp.mjs';
4
4
 
5
5
  function random(...args) {
6
6
  let minimum = 0;
@@ -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,5 +1,5 @@
1
- import { noop } from '../../function/noop.mjs';
2
1
  import { mergeWith } from './mergeWith.mjs';
2
+ import { noop } from '../../function/noop.mjs';
3
3
 
4
4
  function merge(object, ...sources) {
5
5
  return mergeWith(object, ...sources, noop);
@@ -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,5 +1,5 @@
1
- import { cloneDeep } from '../../object/cloneDeep.mjs';
2
1
  import { unset } from './unset.mjs';
2
+ import { cloneDeep } from '../../object/cloneDeep.mjs';
3
3
 
4
4
  function omit(obj, ...keysArr) {
5
5
  if (obj == null) {
@@ -1,6 +1,6 @@
1
- import { isNil } from '../predicate/isNil.mjs';
2
1
  import { get } from './get.mjs';
3
2
  import { set } from './set.mjs';
3
+ import { isNil } from '../predicate/isNil.mjs';
4
4
 
5
5
  function pick(obj, ...keysArr) {
6
6
  if (isNil(obj)) {
@@ -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,5 +1,5 @@
1
- import { isPrimitive } from '../../predicate/isPrimitive.mjs';
2
1
  import { isObject } from './isObject.mjs';
2
+ import { isPrimitive } from '../../predicate/isPrimitive.mjs';
3
3
 
4
4
  function isMatch(target, source) {
5
5
  if (source === target) {
@@ -1,5 +1,5 @@
1
- import { cloneDeep } from '../../object/cloneDeep.mjs';
2
1
  import { isMatch } from './isMatch.mjs';
2
+ import { cloneDeep } from '../../object/cloneDeep.mjs';
3
3
 
4
4
  function matches(source) {
5
5
  source = cloneDeep(source);
@@ -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.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-DD-s3X.js');
15
- const isWeakSet = require('./_chunk/isWeakSet-CGakJk.js');
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-DKBeLp.js');
18
- const pad = require('./_chunk/pad-Cw2pvt.js');
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
 
@@ -1,5 +1,5 @@
1
- import { isTypedArray } from '../predicate/isTypedArray.mjs';
2
1
  import { isPrimitive } from '../predicate/isPrimitive.mjs';
2
+ import { isTypedArray } from '../predicate/isTypedArray.mjs';
3
3
 
4
4
  function clone(obj) {
5
5
  if (isPrimitive(obj)) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const toMerged = require('../_chunk/toMerged-DD-s3X.js');
5
+ const toMerged = require('../_chunk/toMerged-QkD_NC.js');
6
6
 
7
7
  function omit(obj, keys) {
8
8
  const result = { ...obj };
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const isWeakSet = require('../_chunk/isWeakSet-CGakJk.js');
6
- const isPlainObject = require('../_chunk/isPlainObject-DKBeLp.js');
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;
@@ -1,7 +1,7 @@
1
- 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';
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 { isPlainObject } from './isPlainObject.mjs';
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) {
@@ -1,5 +1,5 @@
1
- import { capitalize } from './capitalize.mjs';
2
1
  import { getWords } from './_internal/getWords.mjs';
2
+ import { capitalize } from './capitalize.mjs';
3
3
 
4
4
  function camelCase(str) {
5
5
  const words = getWords(str);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const pad = require('../_chunk/pad-Cw2pvt.js');
5
+ const pad = require('../_chunk/pad-v_6EEn.js');
6
6
 
7
7
  function startCase(str) {
8
8
  const words = pad.getWords(str.trim());
@@ -1,5 +1,5 @@
1
- import { trimStart } from './trimStart.mjs';
2
1
  import { trimEnd } from './trimEnd.mjs';
2
+ import { trimStart } from './trimStart.mjs';
3
3
 
4
4
  function trim(str, chars) {
5
5
  if (chars === undefined) {
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.699+8f7e0960",
4
+ "version": "1.22.0-dev.701+76950349",
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 trimStart(str, chars) {
58
+ function trimEnd(str, chars) {
59
59
  if (chars === undefined) {
60
- return str.trimStart();
60
+ return str.trimEnd();
61
61
  }
62
- let startIndex = 0;
62
+ let endIndex = str.length;
63
63
  switch (typeof chars) {
64
64
  case 'string': {
65
- while (startIndex < str.length && str[startIndex] === chars) {
66
- startIndex++;
65
+ while (endIndex > 0 && str[endIndex - 1] === chars) {
66
+ endIndex--;
67
67
  }
68
68
  break;
69
69
  }
70
70
  case 'object': {
71
- while (startIndex < str.length && chars.includes(str[startIndex])) {
72
- startIndex++;
71
+ while (endIndex > 0 && chars.includes(str[endIndex - 1])) {
72
+ endIndex--;
73
73
  }
74
74
  }
75
75
  }
76
- return str.substring(startIndex);
76
+ return str.substring(0, endIndex);
77
77
  }
78
78
 
79
- function trimEnd(str, chars) {
79
+ function trimStart(str, chars) {
80
80
  if (chars === undefined) {
81
- return str.trimEnd();
81
+ return str.trimStart();
82
82
  }
83
- let endIndex = str.length;
83
+ let startIndex = 0;
84
84
  switch (typeof chars) {
85
85
  case 'string': {
86
- while (endIndex > 0 && str[endIndex - 1] === chars) {
87
- endIndex--;
86
+ while (startIndex < str.length && str[startIndex] === chars) {
87
+ startIndex++;
88
88
  }
89
89
  break;
90
90
  }
91
91
  case 'object': {
92
- while (endIndex > 0 && chars.includes(str[endIndex - 1])) {
93
- endIndex--;
92
+ while (startIndex < str.length && chars.includes(str[startIndex])) {
93
+ startIndex++;
94
94
  }
95
95
  }
96
96
  }
97
- return str.substring(0, endIndex);
97
+ return str.substring(startIndex);
98
98
  }
99
99
 
100
100
  function trim(str, chars) {