1.0.1 • Published 2 years ago

uinix-fp-merge v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

uinix-fp-merge

Build Coverage Downloads Size

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 object
  • x2 (X2) — Second object
Returns
  • X1 & X2 — Returns a deeply-merged object. Does not mutate its inputs.

License

MIT © Chris Zhou