simple-deep-assign
v1.0.0
Published
A very simple alternative of Object.assign() that recursively copies objects' elements to a target object. Recursion is only applied to a pure object. The other types of elements are just replaced with source elements.
Downloads
14
Readme
simple-deep-assign
A very simple alternative of Object.assign()
that recursively copies objects' elements to a target object. Recursion is only applied to a pure object. The other types of elements are just replaced with source elements.
Install
$ npm i simple-deep-assign
Usage
import deepAssign from 'simple-deep-assign';
const target = { a: 'a' };
deepAssign(target, { b: 'b' }, { c: [ 1, 2 ] }, { d: { a: 'a' } }, { d: { b: 'b' } });
target; // { a: 'a', b: 'b', c: [ 1, 2 ], d: { a: 'a', b: 'b' } }
API Document
https://ygoto3.github.io/simple-deep-assign/function/index.html#static-function-simpleDeepAssign