# aug

> A library to augment objects and prototypes

Latest version **4.0.0** (published 2020-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install aug
pnpm add aug
yarn add aug
bun add aug
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2020-11-16 |
| First published | 2011-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 326.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | First+Third |
| Maintainers | jga, dawnerd, ecwillis, orthagonal1, alaguna, aleperez92 |
| Keywords | extend, objects, prototype |

## Links

- npm: https://www.npmjs.com/package/aug
- Repository: https://github.com/firstandthird/aug
- Homepage: https://github.com/firstandthird/aug#readme
- Issues: https://github.com/firstandthird/aug/issues
- npm.io page: https://npm.io/package/aug

## Recent versions

- 4.0.0 (latest) — 2020-11-16
- 3.1.1 — 2019-07-03
- 3.1.0 — 2019-06-26
- 3.0.1 — 2019-04-02
- 3.0.0 — 2019-02-22
- 2.0.1 — 2018-06-25
- 2.0.0 — 2017-07-09
- 1.0.2 — 2017-01-23
- 1.0.1 — 2016-12-10
- 1.0.0 — 2016-12-10
- 0.1.0 — 2013-05-03
- 0.0.5 — 2012-03-22
- 0.0.4 — 2012-03-12
- 0.0.3 — 2012-03-05
- 0.0.2 — 2011-11-11
- … 1 more at https://npm.io/package/aug/versions

## README

<h1 align="center">aug</h1>

<p align="center">
  <a href="https://github.com/firstandthird/aug/actions">
    <img src="https://img.shields.io/github/workflow/status/firstandthird/aug/Test/main?label=Tests&style=for-the-badge" alt="Test Status"/>
  </a>
  <a href="https://github.com/firstandthird/aug/actions">
    <img src="https://img.shields.io/github/workflow/status/firstandthird/aug/Lint/main?label=Lint&style=for-the-badge" alt="Lint Status"/>
  </a>
  <img src="https://img.shields.io/npm/v/aug.svg?label=NPM&style=for-the-badge" alt="NPM Version"/>
</p>

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

## Installation

```sh
npm install aug
```

or

```sh
yarn add aug
```


## Usage

__Deep Merge__

```javascript
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

```javascript
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 href="https://firstandthird.com"><img src="https://firstandthird.com/_static/ui/images/safari-pinned-tab-62813db097.svg" height="32" width="32" align="right"></a>

_A [First + Third](https://firstandthird.com) Project_

---
_Source: https://npm.io/package/aug · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
