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