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:
authorAudrey Eschright <audrey@npmjs.com>2019-01-08 03:40:51 +0300
committerAudrey Eschright <audrey@npmjs.com>2019-01-08 03:40:51 +0300
commitf350e714f66a77f71a7ebe17daeea2ea98179a1a (patch)
tree97fb157ed64d812346b989c551d1ee9f082f9f5c /node_modules/aproba
parentf63a0d6cf0b7db3dcc80e72e1383c3df723c8119 (diff)
aproba@2.0.0
Diffstat (limited to 'node_modules/aproba')
-rw-r--r--node_modules/aproba/CHANGELOG.md4
-rw-r--r--node_modules/aproba/index.js66
-rw-r--r--node_modules/aproba/package.json44
3 files changed, 56 insertions, 58 deletions
diff --git a/node_modules/aproba/CHANGELOG.md b/node_modules/aproba/CHANGELOG.md
new file mode 100644
index 000000000..bab30ecb7
--- /dev/null
+++ b/node_modules/aproba/CHANGELOG.md
@@ -0,0 +1,4 @@
+2.0.0
+ * Drop support for 0.10 and 0.12. They haven't been in travis but still,
+ since we _know_ we'll break with them now it's only polite to do a
+ major bump.
diff --git a/node_modules/aproba/index.js b/node_modules/aproba/index.js
index 6f3f797c0..fd947481b 100644
--- a/node_modules/aproba/index.js
+++ b/node_modules/aproba/index.js
@@ -1,38 +1,39 @@
'use strict'
+module.exports = validate
function isArguments (thingy) {
return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee')
}
-var types = {
- '*': {label: 'any', check: function () { return true }},
- A: {label: 'array', check: function (thingy) { return Array.isArray(thingy) || isArguments(thingy) }},
- S: {label: 'string', check: function (thingy) { return typeof thingy === 'string' }},
- N: {label: 'number', check: function (thingy) { return typeof thingy === 'number' }},
- F: {label: 'function', check: function (thingy) { return typeof thingy === 'function' }},
- O: {label: 'object', check: function (thingy) { return typeof thingy === 'object' && thingy != null && !types.A.check(thingy) && !types.E.check(thingy) }},
- B: {label: 'boolean', check: function (thingy) { return typeof thingy === 'boolean' }},
- E: {label: 'error', check: function (thingy) { return thingy instanceof Error }},
- Z: {label: 'null', check: function (thingy) { return thingy == null }}
+const types = {
+ '*': {label: 'any', check: () => true},
+ A: {label: 'array', check: _ => Array.isArray(_) || isArguments(_)},
+ S: {label: 'string', check: _ => typeof _ === 'string'},
+ N: {label: 'number', check: _ => typeof _ === 'number'},
+ F: {label: 'function', check: _ => typeof _ === 'function'},
+ O: {label: 'object', check: _ => typeof _ === 'object' && _ != null && !types.A.check(_) && !types.E.check(_)},
+ B: {label: 'boolean', check: _ => typeof _ === 'boolean'},
+ E: {label: 'error', check: _ => _ instanceof Error},
+ Z: {label: 'null', check: _ => _ == null}
}
function addSchema (schema, arity) {
- var group = arity[schema.length] = arity[schema.length] || []
+ const group = arity[schema.length] = arity[schema.length] || []
if (group.indexOf(schema) === -1) group.push(schema)
}
-var validate = module.exports = function (rawSchemas, args) {
+function validate (rawSchemas, args) {
if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length)
if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas')
if (!args) throw missingRequiredArg(1, 'args')
if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas)
if (!types.A.check(args)) throw invalidType(1, ['array'], args)
- var schemas = rawSchemas.split('|')
- var arity = {}
+ const schemas = rawSchemas.split('|')
+ const arity = {}
- schemas.forEach(function (schema) {
- for (var ii = 0; ii < schema.length; ++ii) {
- var type = schema[ii]
+ schemas.forEach(schema => {
+ for (let ii = 0; ii < schema.length; ++ii) {
+ const type = schema[ii]
if (!types[type]) throw unknownType(ii, type)
}
if (/E.*E/.test(schema)) throw moreThanOneError(schema)
@@ -43,20 +44,18 @@ var validate = module.exports = function (rawSchemas, args) {
if (schema.length === 1) addSchema('', arity)
}
})
- var matching = arity[args.length]
+ let matching = arity[args.length]
if (!matching) {
throw wrongNumberOfArgs(Object.keys(arity), args.length)
}
- for (var ii = 0; ii < args.length; ++ii) {
- var newMatching = matching.filter(function (schema) {
- var type = schema[ii]
- var typeCheck = types[type].check
+ for (let ii = 0; ii < args.length; ++ii) {
+ let newMatching = matching.filter(schema => {
+ const type = schema[ii]
+ const typeCheck = types[type].check
return typeCheck(args[ii])
})
if (!newMatching.length) {
- var labels = matching.map(function (schema) {
- return types[schema[ii]].label
- }).filter(function (schema) { return schema != null })
+ const labels = matching.map(_ => types[_[ii]].label).filter(_ => _ != null)
throw invalidType(ii, labels, args[ii])
}
matching = newMatching
@@ -72,8 +71,8 @@ function unknownType (num, type) {
}
function invalidType (num, expectedTypes, value) {
- var valueType
- Object.keys(types).forEach(function (typeCode) {
+ let valueType
+ Object.keys(types).forEach(typeCode => {
if (types[typeCode].check(value)) valueType = types[typeCode].label
})
return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' +
@@ -85,8 +84,8 @@ function englishList (list) {
}
function wrongNumberOfArgs (expected, got) {
- var english = englishList(expected)
- var args = expected.every(function (ex) { return ex.length === 1 })
+ const english = englishList(expected)
+ const args = expected.every(ex => ex.length === 1)
? 'argument'
: 'arguments'
return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got)
@@ -98,8 +97,9 @@ function moreThanOneError (schema) {
}
function newException (code, msg) {
- var e = new Error(msg)
- e.code = code
- if (Error.captureStackTrace) Error.captureStackTrace(e, validate)
- return e
+ const err = new Error(msg)
+ err.code = code
+ /* istanbul ignore else */
+ if (Error.captureStackTrace) Error.captureStackTrace(err, validate)
+ return err
}
diff --git a/node_modules/aproba/package.json b/node_modules/aproba/package.json
index 534c6beb5..42a7798b0 100644
--- a/node_modules/aproba/package.json
+++ b/node_modules/aproba/package.json
@@ -1,38 +1,29 @@
{
- "_args": [
- [
- "aproba@1.2.0",
- "/Users/rebecca/code/npm"
- ]
- ],
- "_from": "aproba@1.2.0",
- "_id": "aproba@1.2.0",
+ "_from": "aproba@2.0.0",
+ "_id": "aproba@2.0.0",
"_inBundle": false,
- "_integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
+ "_integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==",
"_location": "/aproba",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
- "raw": "aproba@1.2.0",
+ "raw": "aproba@2.0.0",
"name": "aproba",
"escapedName": "aproba",
- "rawSpec": "1.2.0",
+ "rawSpec": "2.0.0",
"saveSpec": null,
- "fetchSpec": "1.2.0"
+ "fetchSpec": "2.0.0"
},
"_requiredBy": [
+ "#USER",
"/",
- "/copy-concurrently",
- "/gauge",
- "/gentle-fs",
- "/move-concurrently",
- "/npm-profile",
- "/run-queue"
+ "/npm-profile"
],
- "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
- "_spec": "1.2.0",
- "_where": "/Users/rebecca/code/npm",
+ "_resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
+ "_shasum": "52520b8ae5b569215b354efc0caa3fe1e45a8adc",
+ "_spec": "aproba@2.0.0",
+ "_where": "/Users/aeschright/code/cli",
"author": {
"name": "Rebecca Turner",
"email": "me@re-becca.org"
@@ -40,11 +31,13 @@
"bugs": {
"url": "https://github.com/iarna/aproba/issues"
},
+ "bundleDependencies": false,
"dependencies": {},
+ "deprecated": false,
"description": "A ridiculously light-weight argument validator (now browser friendly)",
"devDependencies": {
- "standard": "^10.0.3",
- "tap": "^10.0.2"
+ "standard": "^11.0.1",
+ "tap": "^12.0.1"
},
"directories": {
"test": "test"
@@ -65,7 +58,8 @@
"url": "git+https://github.com/iarna/aproba.git"
},
"scripts": {
- "test": "standard && tap -j3 test/*.js"
+ "pretest": "standard",
+ "test": "tap --100 -J test/*.js"
},
- "version": "1.2.0"
+ "version": "2.0.0"
}