aug

4.0.0last stable release 4 years ago
Complexity Score
Low
Open Issues
N/A
Dependent Projects
46
Weekly Downloadsglobal
959

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Loading Weekly Download Data

Readme

aug

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

Dependencies

No runtime dependency information found for this package.

CVE IssuesActive
0
Scorecards Score
2.70
Test Coverage
No Data
Follows Semver
Yes
Github Stars
18
Dependenciestotal
5
DependenciesOutdated
3
DependenciesDeprecated
0
Threat Modelling
No Data
Repo Audits
No Data

Learn how to distribute aug in your own private NPM registry

npm config set registry  https://npm.cloudsmith.com/owner/repo
Processing...
Done
npm install aug
Processing...
Done

16 Releases

NPM on Cloudsmith

Getting started with NPM on Cloudsmith is fast and easy.