Socket
Socket
Sign inDemoInstall

@ndhoule/defaults

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @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`.


Version published
Weekly downloads
74K
increased by20.86%
Maintainers
1
Install size
35.8 kB
Created
Weekly downloads
 

Changelog

Source

2.0.1

  • Bump @ndhoule/drop, @ndhoule/rest dependency to fix Browserify builds

Readme

Source

defaults CI

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

$ 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.

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.

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.

Keywords

FAQs

Last updated on 02 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc