Skip to content

assign

Create a copy of the first object, and then merge the second object into it recursively. Only plain objects are recursively merged.

Usage

const a = { a: 0, b: 2, p: { a: 4 } };
const b = { a: 1, c: 3, p: { b: 5 } };
assign(a, b); // => { a: 1, b: 2, c: 3, p: { a: 4, b: 5 } }

Installation

Terminal window
npx atmx add helper assign