Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-05-24 23:31:26 +0300
committerRebecca Turner <me@re-becca.org>2018-05-24 23:31:38 +0300
commit0483f5c5deaf18c968a128657923103e49f4e67a (patch)
tree210f154da2f60938471d96a844dcb32cbda09e2a /node_modules/defaults
parent6c294614d800cb95a49ef1c422fbdde65b0731a2 (diff)
Flatten dependencies and add dev deps to git
Diffstat (limited to 'node_modules/defaults')
-rw-r--r--node_modules/defaults/.npmignore1
-rw-r--r--node_modules/defaults/LICENSE21
-rw-r--r--node_modules/defaults/README.md43
-rw-r--r--node_modules/defaults/index.js13
-rw-r--r--node_modules/defaults/package.json57
-rw-r--r--node_modules/defaults/test.js34
6 files changed, 169 insertions, 0 deletions
diff --git a/node_modules/defaults/.npmignore b/node_modules/defaults/.npmignore
new file mode 100644
index 000000000..3c3629e64
--- /dev/null
+++ b/node_modules/defaults/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/defaults/LICENSE b/node_modules/defaults/LICENSE
new file mode 100644
index 000000000..d88b07207
--- /dev/null
+++ b/node_modules/defaults/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Elijah Insua
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/defaults/README.md b/node_modules/defaults/README.md
new file mode 100644
index 000000000..1a4a2ea9c
--- /dev/null
+++ b/node_modules/defaults/README.md
@@ -0,0 +1,43 @@
+# defaults
+
+A simple one level options merge utility
+
+## install
+
+`npm install defaults`
+
+## use
+
+```javascript
+
+var defaults = require('defaults');
+
+var handle = function(options, fn) {
+ options = defaults(options, {
+ timeout: 100
+ });
+
+ setTimeout(function() {
+ fn(options);
+ }, options.timeout);
+}
+
+handle({ timeout: 1000 }, function() {
+ // we're here 1000 ms later
+});
+
+handle({ timeout: 10000 }, function() {
+ // we're here 10s later
+});
+
+```
+
+## summary
+
+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)
diff --git a/node_modules/defaults/index.js b/node_modules/defaults/index.js
new file mode 100644
index 000000000..cb7d75c9c
--- /dev/null
+++ b/node_modules/defaults/index.js
@@ -0,0 +1,13 @@
+var clone = require('clone');
+
+module.exports = function(options, defaults) {
+ options = options || {};
+
+ Object.keys(defaults).forEach(function(key) {
+ if (typeof options[key] === 'undefined') {
+ options[key] = clone(defaults[key]);
+ }
+ });
+
+ return options;
+}; \ No newline at end of file
diff --git a/node_modules/defaults/package.json b/node_modules/defaults/package.json
new file mode 100644
index 000000000..b9fa53146
--- /dev/null
+++ b/node_modules/defaults/package.json
@@ -0,0 +1,57 @@
+{
+ "_from": "defaults@^1.0.3",
+ "_id": "defaults@1.0.3",
+ "_inBundle": false,
+ "_integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
+ "_location": "/defaults",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "defaults@^1.0.3",
+ "name": "defaults",
+ "escapedName": "defaults",
+ "rawSpec": "^1.0.3",
+ "saveSpec": null,
+ "fetchSpec": "^1.0.3"
+ },
+ "_requiredBy": [
+ "/wcwidth"
+ ],
+ "_resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
+ "_shasum": "c656051e9817d9ff08ed881477f3fe4019f3ef7d",
+ "_spec": "defaults@^1.0.3",
+ "_where": "/Users/rebecca/code/npm/node_modules/wcwidth",
+ "author": {
+ "name": "Elijah Insua",
+ "email": "tmpvar@gmail.com"
+ },
+ "bugs": {
+ "url": "https://github.com/tmpvar/defaults/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "clone": "^1.0.2"
+ },
+ "deprecated": false,
+ "description": "merge single level defaults over a config object",
+ "devDependencies": {
+ "tap": "^2.0.0"
+ },
+ "homepage": "https://github.com/tmpvar/defaults#readme",
+ "keywords": [
+ "config",
+ "defaults"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "name": "defaults",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/tmpvar/defaults.git"
+ },
+ "scripts": {
+ "test": "node test.js"
+ },
+ "version": "1.0.3"
+}
diff --git a/node_modules/defaults/test.js b/node_modules/defaults/test.js
new file mode 100644
index 000000000..60e0ffba8
--- /dev/null
+++ b/node_modules/defaults/test.js
@@ -0,0 +1,34 @@
+var defaults = require('./'),
+ test = require('tap').test;
+
+test("ensure options is an object", function(t) {
+ var options = defaults(false, { a : true });
+ t.ok(options.a);
+ t.end()
+});
+
+test("ensure defaults override keys", function(t) {
+ var result = defaults({}, { a: false, b: true });
+ t.ok(result.b, 'b merges over undefined');
+ t.equal(result.a, false, 'a merges over undefined');
+ t.end();
+});
+
+test("ensure defined keys are not overwritten", function(t) {
+ var result = defaults({ b: false }, { a: false, b: true });
+ t.equal(result.b, false, 'b not merged');
+ t.equal(result.a, false, 'a merges over undefined');
+ t.end();
+});
+
+test("ensure defaults clone nested objects", function(t) {
+ var d = { a: [1,2,3], b: { hello : 'world' } };
+ var result = defaults({}, d);
+ t.equal(result.a.length, 3, 'objects should be clones');
+ t.ok(result.a !== d.a, 'objects should be clones');
+
+ t.equal(Object.keys(result.b).length, 1, 'objects should be clones');
+ t.ok(result.b !== d.b, 'objects should be clones');
+ t.end();
+});
+