es-toolkit 1.51.0-dev.2069 → 1.51.0
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/compat/function/debounce.js +1 -1
- package/dist/compat/function/debounce.mjs +1 -1
- package/package.json +1 -44
- package/dist/fp/iterator/chunk.d.mts +0 -19
- package/dist/fp/iterator/chunk.d.ts +0 -19
- package/dist/fp/iterator/chunk.js +0 -24
- package/dist/fp/iterator/chunk.mjs +0 -24
- package/dist/fp/iterator/count.d.mts +0 -20
- package/dist/fp/iterator/count.d.ts +0 -20
- package/dist/fp/iterator/count.js +0 -25
- package/dist/fp/iterator/count.mjs +0 -25
- package/dist/fp/iterator/drop.d.mts +0 -20
- package/dist/fp/iterator/drop.d.ts +0 -20
- package/dist/fp/iterator/drop.js +0 -24
- package/dist/fp/iterator/drop.mjs +0 -24
- package/dist/fp/iterator/dropWhile.d.mts +0 -18
- package/dist/fp/iterator/dropWhile.d.ts +0 -18
- package/dist/fp/iterator/dropWhile.js +0 -23
- package/dist/fp/iterator/dropWhile.mjs +0 -23
- package/dist/fp/iterator/every.d.mts +0 -20
- package/dist/fp/iterator/every.d.ts +0 -20
- package/dist/fp/iterator/every.js +0 -24
- package/dist/fp/iterator/every.mjs +0 -24
- package/dist/fp/iterator/filter.d.mts +0 -37
- package/dist/fp/iterator/filter.d.ts +0 -37
- package/dist/fp/iterator/filter.js +0 -8
- package/dist/fp/iterator/filter.mjs +0 -8
- package/dist/fp/iterator/find.d.mts +0 -20
- package/dist/fp/iterator/find.d.ts +0 -20
- package/dist/fp/iterator/find.js +0 -24
- package/dist/fp/iterator/find.mjs +0 -24
- package/dist/fp/iterator/flatMap.d.mts +0 -20
- package/dist/fp/iterator/flatMap.d.ts +0 -20
- package/dist/fp/iterator/flatMap.js +0 -24
- package/dist/fp/iterator/flatMap.mjs +0 -24
- package/dist/fp/iterator/forEach.d.mts +0 -22
- package/dist/fp/iterator/forEach.d.ts +0 -22
- package/dist/fp/iterator/forEach.js +0 -26
- package/dist/fp/iterator/forEach.mjs +0 -26
- package/dist/fp/iterator/head.d.mts +0 -19
- package/dist/fp/iterator/head.d.ts +0 -19
- package/dist/fp/iterator/head.js +0 -24
- package/dist/fp/iterator/head.mjs +0 -24
- package/dist/fp/iterator/index.d.mts +0 -21
- package/dist/fp/iterator/index.d.ts +0 -21
- package/dist/fp/iterator/index.js +0 -41
- package/dist/fp/iterator/index.mjs +0 -21
- package/dist/fp/iterator/map.d.mts +0 -20
- package/dist/fp/iterator/map.d.ts +0 -20
- package/dist/fp/iterator/map.js +0 -24
- package/dist/fp/iterator/map.mjs +0 -24
- package/dist/fp/iterator/partition.d.mts +0 -22
- package/dist/fp/iterator/partition.d.ts +0 -22
- package/dist/fp/iterator/partition.js +0 -27
- package/dist/fp/iterator/partition.mjs +0 -27
- package/dist/fp/iterator/reduce.d.mts +0 -24
- package/dist/fp/iterator/reduce.d.ts +0 -24
- package/dist/fp/iterator/reduce.js +0 -28
- package/dist/fp/iterator/reduce.mjs +0 -28
- package/dist/fp/iterator/scan.d.mts +0 -21
- package/dist/fp/iterator/scan.d.ts +0 -21
- package/dist/fp/iterator/scan.js +0 -26
- package/dist/fp/iterator/scan.mjs +0 -26
- package/dist/fp/iterator/some.d.mts +0 -20
- package/dist/fp/iterator/some.d.ts +0 -20
- package/dist/fp/iterator/some.js +0 -24
- package/dist/fp/iterator/some.mjs +0 -24
- package/dist/fp/iterator/take.d.mts +0 -21
- package/dist/fp/iterator/take.d.ts +0 -21
- package/dist/fp/iterator/take.js +0 -25
- package/dist/fp/iterator/take.mjs +0 -25
- package/dist/fp/iterator/takeWhile.d.mts +0 -19
- package/dist/fp/iterator/takeWhile.d.ts +0 -19
- package/dist/fp/iterator/takeWhile.js +0 -24
- package/dist/fp/iterator/takeWhile.mjs +0 -24
- package/dist/fp/iterator/toArray.d.mts +0 -21
- package/dist/fp/iterator/toArray.d.ts +0 -21
- package/dist/fp/iterator/toArray.js +0 -25
- package/dist/fp/iterator/toArray.mjs +0 -25
- package/dist/fp/iterator/uniqBy.d.mts +0 -20
- package/dist/fp/iterator/uniqBy.d.ts +0 -20
- package/dist/fp/iterator/uniqBy.js +0 -25
- package/dist/fp/iterator/uniqBy.mjs +0 -25
- package/dist/fp/iterator/zip.d.mts +0 -20
- package/dist/fp/iterator/zip.d.ts +0 -20
- package/dist/fp/iterator/zip.js +0 -25
- package/dist/fp/iterator/zip.mjs +0 -25
- package/dist/iterator/_internal/iterator.js +0 -74
- package/dist/iterator/_internal/iterator.mjs +0 -74
- package/dist/iterator/chunk.d.mts +0 -21
- package/dist/iterator/chunk.d.ts +0 -21
- package/dist/iterator/chunk.js +0 -40
- package/dist/iterator/chunk.mjs +0 -40
- package/dist/iterator/count.d.mts +0 -18
- package/dist/iterator/count.d.ts +0 -18
- package/dist/iterator/count.js +0 -26
- package/dist/iterator/count.mjs +0 -26
- package/dist/iterator/dropWhile.d.mts +0 -20
- package/dist/iterator/dropWhile.d.ts +0 -20
- package/dist/iterator/dropWhile.js +0 -52
- package/dist/iterator/dropWhile.mjs +0 -52
- package/dist/iterator/head.d.mts +0 -21
- package/dist/iterator/head.d.ts +0 -21
- package/dist/iterator/head.js +0 -26
- package/dist/iterator/head.mjs +0 -26
- package/dist/iterator/index.d.mts +0 -12
- package/dist/iterator/index.d.ts +0 -12
- package/dist/iterator/index.js +0 -23
- package/dist/iterator/index.mjs +0 -12
- package/dist/iterator/iterate.d.mts +0 -20
- package/dist/iterator/iterate.d.ts +0 -20
- package/dist/iterator/iterate.js +0 -32
- package/dist/iterator/iterate.mjs +0 -32
- package/dist/iterator/partition.d.mts +0 -18
- package/dist/iterator/partition.d.ts +0 -18
- package/dist/iterator/partition.js +0 -36
- package/dist/iterator/partition.mjs +0 -36
- package/dist/iterator/range.d.mts +0 -42
- package/dist/iterator/range.d.ts +0 -42
- package/dist/iterator/range.js +0 -25
- package/dist/iterator/range.mjs +0 -25
- package/dist/iterator/scan.d.mts +0 -23
- package/dist/iterator/scan.d.ts +0 -23
- package/dist/iterator/scan.js +0 -47
- package/dist/iterator/scan.mjs +0 -47
- package/dist/iterator/takeWhile.d.mts +0 -20
- package/dist/iterator/takeWhile.d.ts +0 -20
- package/dist/iterator/takeWhile.js +0 -34
- package/dist/iterator/takeWhile.mjs +0 -34
- package/dist/iterator/uniqBy.d.mts +0 -22
- package/dist/iterator/uniqBy.d.ts +0 -22
- package/dist/iterator/uniqBy.js +0 -43
- package/dist/iterator/uniqBy.mjs +0 -43
- package/dist/iterator/zip.d.mts +0 -23
- package/dist/iterator/zip.d.ts +0 -23
- package/dist/iterator/zip.js +0 -45
- package/dist/iterator/zip.mjs +0 -45
- package/fp/iterator.d.ts +0 -1
- package/fp/iterator.js +0 -1
- package/iterator.d.ts +0 -1
- package/iterator.js +0 -1
package/dist/iterator/zip.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const require_iterator = require("./_internal/iterator.js");
|
|
2
|
-
//#region src/iterator/zip.ts
|
|
3
|
-
/**
|
|
4
|
-
* Lazily combines several iterators into a single iterator of tuples, pairing
|
|
5
|
-
* the elements at matching positions. Iteration stops as soon as the **shortest**
|
|
6
|
-
* source is exhausted.
|
|
7
|
-
*
|
|
8
|
-
* Stopping at the shortest source (rather than padding to the longest, as the
|
|
9
|
-
* array `zip` does) is what makes this safe to use with infinite iterators:
|
|
10
|
-
* `zip(range(0, Infinity), names.values())` ends with `names`. When iteration
|
|
11
|
-
* ends — because a source ran out or the consumer terminated early — every
|
|
12
|
-
* source is closed via its `return` method.
|
|
13
|
-
*
|
|
14
|
-
* @template T - A tuple of the source iterator types.
|
|
15
|
-
* @param sources - The iterators to zip together.
|
|
16
|
-
* @returns A lazy iterator over tuples of the paired elements.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* zip([1, 2, 3].values(), ['a', 'b'].values()).toArray(); // => [[1, 'a'], [2, 'b']]
|
|
20
|
-
*/
|
|
21
|
-
function zip(...sources) {
|
|
22
|
-
return require_iterator.iterator(function() {
|
|
23
|
-
if (sources.length === 0) return {
|
|
24
|
-
value: void 0,
|
|
25
|
-
done: true
|
|
26
|
-
};
|
|
27
|
-
const tuple = new Array(sources.length);
|
|
28
|
-
for (let index = 0; index < sources.length; index++) {
|
|
29
|
-
const result = sources[index].next();
|
|
30
|
-
if (result.done) return {
|
|
31
|
-
value: void 0,
|
|
32
|
-
done: true
|
|
33
|
-
};
|
|
34
|
-
tuple[index] = result.value;
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
value: tuple,
|
|
38
|
-
done: false
|
|
39
|
-
};
|
|
40
|
-
}, () => {
|
|
41
|
-
for (const source of sources) source.return?.();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
exports.zip = zip;
|
package/dist/iterator/zip.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { iterator } from "./_internal/iterator.mjs";
|
|
2
|
-
//#region src/iterator/zip.ts
|
|
3
|
-
/**
|
|
4
|
-
* Lazily combines several iterators into a single iterator of tuples, pairing
|
|
5
|
-
* the elements at matching positions. Iteration stops as soon as the **shortest**
|
|
6
|
-
* source is exhausted.
|
|
7
|
-
*
|
|
8
|
-
* Stopping at the shortest source (rather than padding to the longest, as the
|
|
9
|
-
* array `zip` does) is what makes this safe to use with infinite iterators:
|
|
10
|
-
* `zip(range(0, Infinity), names.values())` ends with `names`. When iteration
|
|
11
|
-
* ends — because a source ran out or the consumer terminated early — every
|
|
12
|
-
* source is closed via its `return` method.
|
|
13
|
-
*
|
|
14
|
-
* @template T - A tuple of the source iterator types.
|
|
15
|
-
* @param sources - The iterators to zip together.
|
|
16
|
-
* @returns A lazy iterator over tuples of the paired elements.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* zip([1, 2, 3].values(), ['a', 'b'].values()).toArray(); // => [[1, 'a'], [2, 'b']]
|
|
20
|
-
*/
|
|
21
|
-
function zip(...sources) {
|
|
22
|
-
return iterator(function() {
|
|
23
|
-
if (sources.length === 0) return {
|
|
24
|
-
value: void 0,
|
|
25
|
-
done: true
|
|
26
|
-
};
|
|
27
|
-
const tuple = new Array(sources.length);
|
|
28
|
-
for (let index = 0; index < sources.length; index++) {
|
|
29
|
-
const result = sources[index].next();
|
|
30
|
-
if (result.done) return {
|
|
31
|
-
value: void 0,
|
|
32
|
-
done: true
|
|
33
|
-
};
|
|
34
|
-
tuple[index] = result.value;
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
value: tuple,
|
|
38
|
-
done: false
|
|
39
|
-
};
|
|
40
|
-
}, () => {
|
|
41
|
-
for (const source of sources) source.return?.();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { zip };
|
package/fp/iterator.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../dist/fp/iterator';
|
package/fp/iterator.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../dist/fp/iterator');
|
package/iterator.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/iterator';
|
package/iterator.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./dist/iterator');
|