aug

4.0.0 • Public • Published

aug

Test Status Lint Status NPM Version

aug is simple augment/extend library. If you've used jQuery's $.extend, then you will be familiar with it.

Installation

npm install aug

or

yarn add aug

Usage

Deep Merge

import aug from 'aug';
 
const person = { info: { first: 'bob', last: 'smith' } };
const address = { info: { last: 'jones', age: 5 }, address: '123 main st' };
const pet = { pet: { name: 'sparky' } };
 
const merged = 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 same

Defaults

Only merge if it exists in the first argument

import aug from 'aug';
 
const person = { info: { first: 'bob', last: 'smith' } , pet: { name: '' } };
const address = { info: { last: 'jones', age: 5 }, address: '123 main st' };
const pet = { pet: { name: 'sparky' } };
 
const merged = aug.defaults(person, address, pet);
 
//merged == { info: { first: 'bob', last: 'jones' }, pet: { name: 'sparky' }}
//person, address, pet objects stay the same

A First + Third Project

Package Sidebar

Install

npm i aug

Weekly Downloads

855

Version

4.0.0

License

MIT

Unpacked Size

334 kB

Total Files

18

Last publish

Collaborators

  • jga
  • dawnerd
  • ecwillis
  • orthagonal1
  • alaguna
  • aleperez92