Socket
Socket
Sign inDemoInstall

defaults

Package Overview
Dependencies
1
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

55

package.json
{
"name": "defaults",
"version": "1.0.3",
"description": "merge single level defaults over a config object",
"main": "index.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git://github.com/tmpvar/defaults.git"
},
"keywords": [
"config",
"defaults"
],
"author": "Elijah Insua <tmpvar@gmail.com>",
"license": "MIT",
"readmeFilename": "README.md",
"dependencies": {
"clone": "^1.0.2"
},
"devDependencies": {
"tap": "^2.0.0"
}
"name": "defaults",
"version": "1.0.4",
"description": "merge single level defaults over a config object",
"main": "index.js",
"funding": "https://github.com/sponsors/sindresorhus",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git://github.com/sindresorhus/node-defaults.git"
},
"keywords": [
"config",
"defaults",
"options",
"object",
"merge",
"assign",
"properties",
"deep"
],
"author": "Elijah Insua <tmpvar@gmail.com>",
"license": "MIT",
"readmeFilename": "README.md",
"dependencies": {
"clone": "^1.0.2"
},
"devDependencies": {
"tap": "^2.0.0"
}
}
# defaults
A simple one level options merge utility
> A simple one level options merge utility
## install
## Install
`npm install defaults`
```sh
npm install defaults
```
## use
## Usage
```javascript
```js
const defaults = require('defaults');
var defaults = require('defaults');
const handle = (options, fn) => {
options = defaults(options, {
timeout: 100
});
var handle = function(options, fn) {
options = defaults(options, {
timeout: 100
});
setTimeout(function() {
fn(options);
}, options.timeout);
setTimeout(() => {
fn(options);
}, options.timeout);
}
handle({ timeout: 1000 }, function() {
// we're here 1000 ms later
handle({timeout: 1000}, () => {
// We're here 1000 ms later
});
handle({ timeout: 10000 }, function() {
// we're here 10s later
handle({timeout: 10000}, () => {
// We're here 10s later
});
```
## summary
## Summary

@@ -40,5 +40,1 @@ this module exports a function that takes 2 arguments: `options` and `defaults`. When called, it overrides all of `undefined` properties in `options` with the clones of properties defined in `defaults`

Sidecases: if called with a falsy `options` value, options will be initialized to a new object before being merged onto.
## license
[MIT](LICENSE)

Sorry, the diff of this file is not supported yet

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