|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
485 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | import { unzip } from './unzip.mjs';
|
|---|
| 2 | import { isFunction } from '../../predicate/isFunction.mjs';
|
|---|
| 3 |
|
|---|
| 4 | function zipWith(...combine) {
|
|---|
| 5 | let iteratee = combine.pop();
|
|---|
| 6 | if (!isFunction(iteratee)) {
|
|---|
| 7 | combine.push(iteratee);
|
|---|
| 8 | iteratee = undefined;
|
|---|
| 9 | }
|
|---|
| 10 | if (!combine?.length) {
|
|---|
| 11 | return [];
|
|---|
| 12 | }
|
|---|
| 13 | const result = unzip(combine);
|
|---|
| 14 | if (iteratee == null) {
|
|---|
| 15 | return result;
|
|---|
| 16 | }
|
|---|
| 17 | return result.map(group => iteratee(...group));
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | export { zipWith };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.