Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ndhoule/defaults

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

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

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-34.92%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 02 May 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc