UNPKG
imma
Version:
latest (0.0.1)
0.0.1
A collection of functions for dealing with native arrays and objects immutably
imma
/
lib
/
array
/
mergeWith.js
13 lines
(12 loc)
•
297 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
'use strict'
const
mergeWith =
module
.
exports
=
(
arrays, fn
) =>
{
const
result = []
for
(
let
array
of
arrays) {
for
(
let
index
in
array) { result[index] = index
in
result ?
fn
(result[index], array[index], index) : array[index] } }
return
result }