# @ndhoule/defaults

> Copies owned, enumerable properties from a source object(s) to a target object when the value of that property on the source object is `undefined`.

Latest version **2.0.1** (published 2016-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ndhoule/defaults
pnpm add @ndhoule/defaults
yarn add @ndhoule/defaults
bun add @ndhoule/defaults
```

## Health

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

Warnings: low downloads; no types; no esm support; has vulnerabilities.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2016-05-02 |
| First published | 2015-05-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 1 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nathan Houle |
| Maintainers | ndhoule |
| Keywords | component, defaults |

## Links

- npm: https://www.npmjs.com/package/@ndhoule/defaults
- Repository: https://github.com/ndhoule/defaults
- Issues: https://github.com/ndhoule/defaults/issues
- npm.io page: https://npm.io/package/@ndhoule/defaults

## Dependencies (2)

- [@ndhoule/drop](https://npm.io/package/@ndhoule/drop.md) ^2.0.0
- [@ndhoule/rest](https://npm.io/package/@ndhoule/rest.md) ^2.0.0

## Recent versions

- 2.0.1 (latest) — 2016-05-02
- 2.0.0 — 2016-05-02
- 1.1.1 — 2015-07-15
- 1.1.0 — 2015-07-15
- 1.0.1 — 2015-05-03

## README

# defaults [![CI][ci-badge]][ci-link]

Copies owned, enumerable properties from a source object(s) to a target object when the value of that property on the source object is `undefined`.

## Installation

```sh
$ component install ndhoule/defaults
$ npm install @ndhoule/defaults
```

## API

### `defaults(target : Object, sources : ...Object)` => Object

Copies owned, enumerable properties from a source object(s) to a target object when the value of that property on the source object is `undefined`.

```javascript
var a = { a: 1 };
var b = { a: 2, b: 2 };

defaults(a, b);
console.log(a); //=> { a: 1, b: 2 }
```

### `defaults.deep(target : Object, sources : ...Object)` => Object

Deeply copies owned, enumerable properties from a source object(s), recursing on object properties, to a target object when the value of that property on the source object is `undefined`.

```javascript
var a = { a: 1, b: { c: 3 } };
var b = { a: 2, b: { d: 4 } };

defaults(a, b);
console.log(a); //=> { a: 1, b: { c: 3, d: 4} }
```

## License

Released under the [MIT license](LICENSE.md).

[ci-link]: https://travis-ci.org/ndhoule/defaults
[ci-badge]: https://travis-ci.org/ndhoule/defaults.svg?branch=master

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