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