aug
A library to augment objects and prototypes
Last updated 3 months ago by aleperez92 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install aug 
SYNC missed versions from official npm registry.

aug.js

Build Status npm

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

Installation

npm install aug

Usage

Deep Merge

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

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

Current Tags

  • 3.1.1                                ...           latest (3 months ago)

15 Versions

  • 3.1.1                                ...           3 months ago
  • 3.1.0                                ...           3 months ago
  • 3.0.1                                ...           6 months ago
  • 3.0.0                                ...           7 months ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           2 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.1.0                                ...           6 years ago
  • 0.0.5                                ...           7 years ago
  • 0.0.4                                ...           8 years ago
  • 0.0.3                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           8 years ago

Copyright 2014 - 2016 © taobao.org |