es-toolkit 1.35.0-dev.1206 → 1.35.0-dev.1209

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.
@@ -12,6 +12,7 @@ export { partition } from '../array/partition.mjs';
12
12
  export { pullAt } from '../array/pullAt.mjs';
13
13
  export { sampleSize } from '../array/sampleSize.mjs';
14
14
  export { shuffle } from '../array/shuffle.mjs';
15
+ export { toInteger } from './util/toInteger.mjs';
15
16
  export { toFilled } from '../array/toFilled.mjs';
16
17
  export { unzipWith } from '../array/unzipWith.mjs';
17
18
  export { windowed } from '../array/windowed.mjs';
@@ -293,7 +294,6 @@ export { stubTrue } from './util/stubTrue.mjs';
293
294
  export { times } from './util/times.mjs';
294
295
  export { toArray } from './util/toArray.mjs';
295
296
  export { toFinite } from './util/toFinite.mjs';
296
- export { toInteger } from './util/toInteger.mjs';
297
297
  export { toLength } from './util/toLength.mjs';
298
298
  export { toNumber } from './util/toNumber.mjs';
299
299
  export { toPath } from './util/toPath.mjs';
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
4
 
5
- const zipWith = require('../_chunk/zipWith-ChDTPy.js');
5
+ const zipWith = require('../_chunk/zipWith-CsbMsR.js');
6
6
  const AbortError = require('../_chunk/AbortError-Cg4ZQ1.js');
7
7
  const error_index = require('../error/index.js');
8
8
  const unary = require('../_chunk/unary-EIEhcF.js');
9
9
  const noop = require('../_chunk/noop-2IwLUk.js');
10
10
  const range = require('../_chunk/range-HnEIT7.js');
11
11
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
12
- const compat_index = require('../_chunk/toSnakeCaseKeys-DCXJ3Q.js');
12
+ const compat_index = require('../_chunk/toSnakeCaseKeys-Bvb9j3.js');
13
13
  const isPromise = require('../_chunk/isPromise-BqEEYJ.js');
14
14
  const promise_index = require('../promise/index.js');
15
15
  const reverseString = require('../_chunk/reverseString-BixeGz.js');
@@ -26,12 +26,16 @@ exports.groupBy = zipWith.groupBy;
26
26
  exports.initial = zipWith.initial;
27
27
  exports.isSubset = zipWith.isSubset;
28
28
  exports.isSubsetWith = zipWith.isSubsetWith;
29
+ exports.isSymbol = zipWith.isSymbol;
29
30
  exports.keyBy = zipWith.keyBy;
30
31
  exports.partition = zipWith.partition;
31
32
  exports.pullAt = zipWith.pullAt;
32
33
  exports.sampleSize = zipWith.sampleSize;
33
34
  exports.shuffle = zipWith.shuffle;
34
35
  exports.toFilled = zipWith.toFilled;
36
+ exports.toFinite = zipWith.toFinite;
37
+ exports.toInteger = zipWith.toInteger;
38
+ exports.toNumber = zipWith.toNumber;
35
39
  exports.unzipWith = zipWith.unzipWith;
36
40
  exports.windowed = zipWith.windowed;
37
41
  exports.xor = zipWith.xor;
@@ -161,7 +165,6 @@ exports.isRegExp = compat_index.isRegExp;
161
165
  exports.isSafeInteger = compat_index.isSafeInteger;
162
166
  exports.isSet = compat_index.isSet;
163
167
  exports.isString = compat_index.isString;
164
- exports.isSymbol = compat_index.isSymbol;
165
168
  exports.isTypedArray = compat_index.isTypedArray;
166
169
  exports.isWeakMap = compat_index.isWeakMap;
167
170
  exports.isWeakSet = compat_index.isWeakSet;
@@ -261,12 +264,9 @@ exports.times = compat_index.times;
261
264
  exports.toArray = compat_index.toArray;
262
265
  exports.toCamelCaseKeys = compat_index.toCamelCaseKeys;
263
266
  exports.toDefaulted = compat_index.toDefaulted;
264
- exports.toFinite = compat_index.toFinite;
265
- exports.toInteger = compat_index.toInteger;
266
267
  exports.toLength = compat_index.toLength;
267
268
  exports.toLower = compat_index.toLower;
268
269
  exports.toMerged = compat_index.toMerged;
269
- exports.toNumber = compat_index.toNumber;
270
270
  exports.toPairs = compat_index.toPairs;
271
271
  exports.toPairsIn = compat_index.toPairsIn;
272
272
  exports.toPath = compat_index.toPath;
@@ -12,6 +12,7 @@ export { partition } from '../array/partition.mjs';
12
12
  export { pullAt } from '../array/pullAt.mjs';
13
13
  export { sampleSize } from '../array/sampleSize.mjs';
14
14
  export { shuffle } from '../array/shuffle.mjs';
15
+ export { toInteger } from './util/toInteger.mjs';
15
16
  export { toFilled } from '../array/toFilled.mjs';
16
17
  export { unzipWith } from '../array/unzipWith.mjs';
17
18
  export { windowed } from '../array/windowed.mjs';
@@ -293,7 +294,6 @@ export { stubTrue } from './util/stubTrue.mjs';
293
294
  export { times } from './util/times.mjs';
294
295
  export { toArray } from './util/toArray.mjs';
295
296
  export { toFinite } from './util/toFinite.mjs';
296
- export { toInteger } from './util/toInteger.mjs';
297
297
  export { toLength } from './util/toLength.mjs';
298
298
  export { toNumber } from './util/toNumber.mjs';
299
299
  export { toPath } from './util/toPath.mjs';
@@ -1,9 +1,15 @@
1
+ import { isIterateeCall } from '../_internal/isIterateeCall.mjs';
1
2
  import { eq } from '../util/eq.mjs';
2
3
 
3
4
  function defaults(object, ...sources) {
4
5
  object = Object(object);
5
6
  const objectProto = Object.prototype;
6
- for (let i = 0; i < sources.length; i++) {
7
+ let length = sources.length;
8
+ const guard = length > 2 ? sources[2] : undefined;
9
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
10
+ length = 1;
11
+ }
12
+ for (let i = 0; i < length; i++) {
7
13
  const source = sources[i];
8
14
  const keys = Object.keys(source);
9
15
  for (let j = 0; j < keys.length; j++) {
@@ -12,6 +12,6 @@
12
12
  * repeat('abc', 0); // ''
13
13
  * repeat('abc', 2); // 'abcabc'
14
14
  */
15
- declare function repeat(str: string, n: number): string;
15
+ declare function repeat(str: string, n?: number, guard?: unknown): string;
16
16
 
17
17
  export { repeat };
@@ -12,6 +12,6 @@
12
12
  * repeat('abc', 0); // ''
13
13
  * repeat('abc', 2); // 'abcabc'
14
14
  */
15
- declare function repeat(str: string, n: number): string;
15
+ declare function repeat(str: string, n?: number, guard?: unknown): string;
16
16
 
17
17
  export { repeat };
@@ -1,5 +1,15 @@
1
- function repeat(str, n) {
2
- return str.repeat(n);
1
+ import { isIterateeCall } from '../_internal/isIterateeCall.mjs';
2
+ import { toInteger } from '../util/toInteger.mjs';
3
+ import { toString } from '../util/toString.mjs';
4
+
5
+ function repeat(str, n, guard) {
6
+ if (guard ? isIterateeCall(str, n, guard) : n === undefined) {
7
+ n = 1;
8
+ }
9
+ else {
10
+ n = toInteger(n);
11
+ }
12
+ return toString(str).repeat(n);
3
13
  }
4
14
 
5
15
  export { repeat };
@@ -10,6 +10,6 @@
10
10
  * // => ['fred', 'barney', 'pebbles']
11
11
  *
12
12
  */
13
- declare function words(str?: string | object, pattern?: RegExp | string): string[];
13
+ declare function words(str?: string | object, pattern?: RegExp | string, guard?: unknown): string[];
14
14
 
15
15
  export { words };
@@ -10,6 +10,6 @@
10
10
  * // => ['fred', 'barney', 'pebbles']
11
11
  *
12
12
  */
13
- declare function words(str?: string | object, pattern?: RegExp | string): string[];
13
+ declare function words(str?: string | object, pattern?: RegExp | string, guard?: unknown): string[];
14
14
 
15
15
  export { words };
@@ -1,8 +1,9 @@
1
1
  import { CASE_SPLIT_PATTERN } from '../../string/words.mjs';
2
2
  import { toString } from '../util/toString.mjs';
3
3
 
4
- function words(str, pattern = CASE_SPLIT_PATTERN) {
4
+ function words(str, pattern = CASE_SPLIT_PATTERN, guard) {
5
5
  const input = toString(str);
6
+ pattern = guard ? CASE_SPLIT_PATTERN : pattern;
6
7
  const words = Array.from(input.match(pattern) ?? []);
7
8
  return words.filter(x => x !== '');
8
9
  }
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const zipWith = require('./_chunk/zipWith-ChDTPy.js');
5
+ const zipWith = require('./_chunk/zipWith-CsbMsR.js');
6
6
  const array_index = require('./array/index.js');
7
7
  const AbortError = require('./_chunk/AbortError-Cg4ZQ1.js');
8
8
  const error_index = require('./error/index.js');
@@ -12,7 +12,7 @@ const noop = require('./_chunk/noop-2IwLUk.js');
12
12
  const range = require('./_chunk/range-HnEIT7.js');
13
13
  const randomInt = require('./_chunk/randomInt-CF7bZK.js');
14
14
  const math_index = require('./math/index.js');
15
- const compat_index = require('./_chunk/toSnakeCaseKeys-DCXJ3Q.js');
15
+ const compat_index = require('./_chunk/toSnakeCaseKeys-Bvb9j3.js');
16
16
  const object_index = require('./object/index.js');
17
17
  const isPromise = require('./_chunk/isPromise-BqEEYJ.js');
18
18
  const predicate_index = require('./predicate/index.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const compat_index = require('../_chunk/toSnakeCaseKeys-DCXJ3Q.js');
5
+ const compat_index = require('../_chunk/toSnakeCaseKeys-Bvb9j3.js');
6
6
 
7
7
  function mergeWith(target, source, merge) {
8
8
  const sourceKeys = Object.keys(source);
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.35.0-dev.1206+cfa42440",
4
+ "version": "1.35.0-dev.1209+d7d8f2c6",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {