|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
535 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | function unzipWith(target, iteratee) {
|
|---|
| 6 | const maxLength = Math.max(...target.map(innerArray => innerArray.length));
|
|---|
| 7 | const result = new Array(maxLength);
|
|---|
| 8 | for (let i = 0; i < maxLength; i++) {
|
|---|
| 9 | const group = new Array(target.length);
|
|---|
| 10 | for (let j = 0; j < target.length; j++) {
|
|---|
| 11 | group[j] = target[j][i];
|
|---|
| 12 | }
|
|---|
| 13 | result[i] = iteratee(...group);
|
|---|
| 14 | }
|
|---|
| 15 | return result;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | exports.unzipWith = unzipWith;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.