uinix-fp-merge
v1.0.1
Published
uinix fp merge utility
Downloads
4
Readme
uinix-fp-merge
uinix-fp
merge utility.
Install
This package is ESM-only and requires Node 12+.
npm install uinix-fp-merge
Use
merge
deeply merges two provided objects without mutating them. Arrays are merged with a replace strategy.
const x1 = {a: {b: {}}, c: [1, 2, 3]};
const x2 = {a: {b: {d: 'e'}}, c: [8, 9, 10], e: {f: 'g'}};
merge(x1)(x2); // {a: {b: {d: 'e'}}, c: [8, 9, 10], e: {f:'g'}}
API
This package exports the following identifiers: merge
. There is no default export.
merge(x1)(x2)
Parameters (Curried)
x1
(X1
) — First objectx2
(X2
) — Second object
Returns
X1 & X2
— Returns a deeply-merged object. Does not mutate its inputs.