@f/defaults

Soft version of extend. Assigns own properties only if they are undefined in the original object.

Stats

StarsIssuesVersionUpdatedCreatedSize
@f/defaults
001.0.16 years ago6 years agoMinified + gzip package size for @f/defaults in KB

Readme

defaults

Build status Git tag NPM version Code style

Soft version of extend. Assigns own properties only if they are undefined in the original object.

Installation

$ npm install @f/defaults

Usage

var defaults = require('@f/defaults')

defaults({a: 1}, {a: 2}) // => {a: 1}

defaults({a: 1}, {b: 2}) // => {a: 1, b: 2}

API

defaults(obj, defaults)

  • obj - Object to extend with defaults
  • defaults - Default values

Returns: obj with applied defaults.

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.