/object/merge
stdMerges two objects deeply.
Type signature
(a: GenericObject, b: GenericObject) => GenericObject;
export default merge
Examples
merge({ a: 1, b: 3 }, {});
// ⇒ { a: 1, b: 3 }
Try in REPL
merge({ a: 1, b: 3 }, { b: 7 });
// ⇒ { a: 1, b: 7 }
Try in REPL
merge(
{ a: 1, b: 3 },
{ b: { d: 8 } },
);
// ⇒ { a: 1, b: { d: 8 } }
Try in REPL
merge(
{ a: 1, b: { c: 3 } },
{ b: { d: 8 } },
);
// ⇒ { a: 1, b: { c: 3, d: 8 } }
Try in REPL
Questions
- How to merge two objects together?
- How to deeply merge two objects?