aug is simple augment/extend library. If you've used jQuery's $.extend, then you will be familiar with it.
npm install augor
yarn add augDeep Merge
importaugfrom'aug';constperson={info: {first: 'bob',last: 'smith'}};constaddress={info: {last: 'jones',age: 5},address: '123 main st'};constpet={pet: {name: 'sparky'}};constmerged=aug(person,address,pet);//merged == { info: { first: 'bob', last: 'jones', age: 5 }, address: '123 main st ', pet: { name: 'sparky }};//person, address, pet objects stay the sameDefaults
Only merge if it exists in the first argument
importaugfrom'aug';constperson={info: {first: 'bob',last: 'smith'},pet: {name: ''}};constaddress={info: {last: 'jones',age: 5},address: '123 main st'};constpet={pet: {name: 'sparky'}};constmerged=aug.defaults(person,address,pet);//merged == { info: { first: 'bob', last: 'jones' }, pet: { name: 'sparky' }}//person, address, pet objects stay the sameA First + Third Project