Repository URL to install this package:
|
Version:
1.16.0 ▾
|
{
"_from": "defaults@>=1.0.0 <2.0.0",
"_id": "defaults@1.0.3",
"_location": "/defaults",
"_nodeVersion": "4.1.1",
"_npmUser": {
"name": "tmpvar",
"email": "tmpvar@gmail.com"
},
"_npmVersion": "2.14.4",
"_phantomChildren": {},
"_requiredBy": [
"/wcwidth"
],
"_resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
"_shasum": "c656051e9817d9ff08ed881477f3fe4019f3ef7d",
"_shrinkwrap": null,
"author": {
"name": "Elijah Insua",
"email": "tmpvar@gmail.com"
},
"bugs": {
"url": "https://github.com/tmpvar/defaults/issues"
},
"dependencies": {
"clone": "^1.0.2"
},
"description": "merge single level defaults over a config object",
"devDependencies": {
"tap": "^2.0.0"
},
"directories": {},
"dist": {
"shasum": "c656051e9817d9ff08ed881477f3fe4019f3ef7d",
"tarball": "http://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz"
},
"gitHead": "8831ec32a5f999bfae1a8c9bf32880971ed7c6f2",
"homepage": "https://github.com/tmpvar/defaults#readme",
"keywords": [
"config",
"defaults"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "tmpvar",
"email": "tmpvar@gmail.com"
}
],
"name": "defaults",
"optionalDependencies": {},
"readme": "# defaults\n\nA simple one level options merge utility\n\n## install\n\n`npm install defaults`\n\n## use\n\n```javascript\n\nvar defaults = require('defaults');\n\nvar handle = function(options, fn) {\n options = defaults(options, {\n timeout: 100\n });\n\n setTimeout(function() {\n fn(options);\n }, options.timeout);\n}\n\nhandle({ timeout: 1000 }, function() {\n // we're here 1000 ms later\n});\n\nhandle({ timeout: 10000 }, function() {\n // we're here 10s later\n});\n\n```\n\n## summary\n\nthis 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`\n\nSidecases: if called with a falsy `options` value, options will be initialized to a new object before being merged onto.\n\n## license\n\n[MIT](LICENSE)\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/tmpvar/defaults.git"
},
"scripts": {
"test": "node test.js"
},
"version": "1.0.3"
}