@naturalcycles/js-lib 14.198.0 → 14.199.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.
|
@@ -171,3 +171,4 @@ export declare function _maxBy<T>(array: T[], mapper: Mapper<T, number | undefin
|
|
|
171
171
|
export declare function _minBy<T>(array: T[], mapper: Mapper<T, number | undefined>): T;
|
|
172
172
|
export declare function _maxByOrUndefined<T>(array: T[], mapper: Mapper<T, number | undefined>): T | undefined;
|
|
173
173
|
export declare function _minByOrUndefined<T>(array: T[], mapper: Mapper<T, number | undefined>): T | undefined;
|
|
174
|
+
export declare function _zip<T1, T2>(array1: T1[], array2: T2[]): [T1, T2][];
|
package/dist/array/array.util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._minByOrUndefined = exports._maxByOrUndefined = exports._minBy = exports._maxBy = exports._max = exports._maxOrUndefined = exports._min = exports._minOrUndefined = exports._lastOrUndefined = exports._last = exports._shuffle = exports._mapToObject = exports._sumBy = exports._sum = exports._difference = exports._intersection = exports._countBy = exports._dropRightWhile = exports._dropWhile = exports._takeRightWhile = exports._takeWhile = exports._findLast = exports._sortDescBy = exports._sortBy = exports._groupBy = exports._mapBy = exports._by = exports._uniqBy = exports._pushUniqBy = exports._pushUniq = exports._uniq = exports._chunk = void 0;
|
|
3
|
+
exports._zip = exports._minByOrUndefined = exports._maxByOrUndefined = exports._minBy = exports._maxBy = exports._max = exports._maxOrUndefined = exports._min = exports._minOrUndefined = exports._lastOrUndefined = exports._last = exports._shuffle = exports._mapToObject = exports._sumBy = exports._sum = exports._difference = exports._intersection = exports._countBy = exports._dropRightWhile = exports._dropWhile = exports._takeRightWhile = exports._takeWhile = exports._findLast = exports._sortDescBy = exports._sortBy = exports._groupBy = exports._mapBy = exports._by = exports._uniqBy = exports._pushUniqBy = exports._pushUniq = exports._uniq = exports._chunk = void 0;
|
|
4
4
|
const is_util_1 = require("../is.util");
|
|
5
5
|
/**
|
|
6
6
|
* Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
|
|
@@ -378,3 +378,12 @@ function _minByOrUndefined(array, mapper) {
|
|
|
378
378
|
return minItem;
|
|
379
379
|
}
|
|
380
380
|
exports._minByOrUndefined = _minByOrUndefined;
|
|
381
|
+
function _zip(array1, array2) {
|
|
382
|
+
const len = Math.min(array1.length, array2.length);
|
|
383
|
+
const res = [];
|
|
384
|
+
for (let i = 0; i < len; i++) {
|
|
385
|
+
res.push([array1[i], array2[i]]);
|
|
386
|
+
}
|
|
387
|
+
return res;
|
|
388
|
+
}
|
|
389
|
+
exports._zip = _zip;
|
|
@@ -343,3 +343,11 @@ export function _minByOrUndefined(array, mapper) {
|
|
|
343
343
|
});
|
|
344
344
|
return minItem;
|
|
345
345
|
}
|
|
346
|
+
export function _zip(array1, array2) {
|
|
347
|
+
const len = Math.min(array1.length, array2.length);
|
|
348
|
+
const res = [];
|
|
349
|
+
for (let i = 0; i < len; i++) {
|
|
350
|
+
res.push([array1[i], array2[i]]);
|
|
351
|
+
}
|
|
352
|
+
return res;
|
|
353
|
+
}
|
package/package.json
CHANGED
package/src/array/array.util.ts
CHANGED
|
@@ -402,3 +402,14 @@ export function _minByOrUndefined<T>(
|
|
|
402
402
|
|
|
403
403
|
return minItem
|
|
404
404
|
}
|
|
405
|
+
|
|
406
|
+
export function _zip<T1, T2>(array1: T1[], array2: T2[]): [T1, T2][] {
|
|
407
|
+
const len = Math.min(array1.length, array2.length)
|
|
408
|
+
const res: [T1, T2][] = []
|
|
409
|
+
|
|
410
|
+
for (let i = 0; i < len; i++) {
|
|
411
|
+
res.push([array1[i]!, array2[i]!])
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return res
|
|
415
|
+
}
|