|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
598 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const unzip = require('./unzip.js');
|
|---|
| 6 | const isFunction = require('../../predicate/isFunction.js');
|
|---|
| 7 |
|
|---|
| 8 | function zipWith(...combine) {
|
|---|
| 9 | let iteratee = combine.pop();
|
|---|
| 10 | if (!isFunction.isFunction(iteratee)) {
|
|---|
| 11 | combine.push(iteratee);
|
|---|
| 12 | iteratee = undefined;
|
|---|
| 13 | }
|
|---|
| 14 | if (!combine?.length) {
|
|---|
| 15 | return [];
|
|---|
| 16 | }
|
|---|
| 17 | const result = unzip.unzip(combine);
|
|---|
| 18 | if (iteratee == null) {
|
|---|
| 19 | return result;
|
|---|
| 20 | }
|
|---|
| 21 | return result.map(group => iteratee(...group));
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | exports.zipWith = zipWith;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.