deepmerge icon indicating copy to clipboard operation
deepmerge copied to clipboard

Clarify in docs this supports immutable-object pattern

Open candidia opened this issue 1 year ago • 1 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

It's not clear without testing that this doesn't modify the input.

Documenting this explicitly could boost adoption among people looking for a library compatible with immutable data structures. Maybe a description similar to https://immerjs.github.io/immer/#immer-simplifies-handling-immutable-data-structures

Motivation

No response

Example

const a = { a: 'value' }
const b = { b: 404 }
const result = deepMerge()(a, b);
console.log(result); // {a: 'value',  b: 404 }
console.log(a); // {a: 'value'}
console.log(b); // {b: 404}
console.log(a === result); // false
console.log(b === result); // false

candidia avatar Aug 10 '24 14:08 candidia

If you like you can provide a PR.

Uzlopak avatar Aug 10 '24 14:08 Uzlopak