diff options
author | Rebecca Turner <me@re-becca.org> | 2017-06-03 02:28:31 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-06-03 02:28:46 +0300 |
commit | a6f7a52e7292b781d2a4df5489d4ae4b90b32206 (patch) | |
tree | 8634c10000d31021670ae38ffa73a173c09f1582 /node_modules/aproba | |
parent | 37b85db02a8f74750b956f2ca881e3ce34599be9 (diff) |
aproba@1.1.2
Diffstat (limited to 'node_modules/aproba')
-rw-r--r-- | node_modules/aproba/README.md | 22 | ||||
-rw-r--r-- | node_modules/aproba/index.js | 18 | ||||
-rw-r--r-- | node_modules/aproba/package.json | 30 |
3 files changed, 35 insertions, 35 deletions
diff --git a/node_modules/aproba/README.md b/node_modules/aproba/README.md index a9d38222a..79e865924 100644 --- a/node_modules/aproba/README.md +++ b/node_modules/aproba/README.md @@ -20,17 +20,17 @@ myfunc('test', 23, function () {}, true) // too many args error Valid types are: -type | description ----- | ----------- -* | matches any type -A | Array.isArray OR an arguments object -S | typeof == string -N | typeof == number -F | typeof == function -O | typeof == object and not type A and not type E -B | typeof == boolean -E | instanceof Error OR null **(special: see below)** -Z | == null +| type | description +| :--: | :---------- +| * | matches any type +| A | `Array.isArray` OR an `arguments` object +| S | typeof == string +| N | typeof == number +| F | typeof == function +| O | typeof == object and not type A and not type E +| B | typeof == boolean +| E | `instanceof Error` OR `null` **(special: see below)** +| Z | == `null` Validation failures throw one of three exception types, distinguished by a `code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`. diff --git a/node_modules/aproba/index.js b/node_modules/aproba/index.js index bc6ed1f17..4f8c1fc7d 100644 --- a/node_modules/aproba/index.js +++ b/node_modules/aproba/index.js @@ -16,6 +16,11 @@ var types = { Z: {label: 'null', check: function (thingy) { return thingy == null }} } +function addSchema (schema, arity) { + var group = arity[schema.length] = arity[schema.length] || [] + if (group.indexOf(schema) === -1) group.push(schema) +} + var validate = module.exports = function (rawSchemas, args) { if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length) if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas') @@ -24,21 +29,18 @@ var validate = module.exports = function (rawSchemas, args) { if (!types.A.check(args)) throw invalidType(1, ['array'], args) var schemas = rawSchemas.split('|') var arity = {} - function addSchema (schema) { - var group = arity[schema.length] = arity[schema.length] || [] - if (group.indexOf(schema) === -1) group.push(schema) - } + schemas.forEach(function (schema) { for (var ii = 0; ii < schema.length; ++ii) { var type = schema[ii] if (!types[type]) throw unknownType(ii, type) } if (/E.*E/.test(schema)) throw moreThanOneError(schema) - addSchema(schema) + addSchema(schema, arity) if (/E/.test(schema)) { - addSchema(schema.replace(/E.*$/, 'E')) - addSchema(schema.replace(/E/, 'Z')) - if (schema.length === 1) addSchema('') + addSchema(schema.replace(/E.*$/, 'E'), arity) + addSchema(schema.replace(/E/, 'Z'), arity) + if (schema.length === 1) addSchema('', arity) } }) var matching = arity[args.length] diff --git a/node_modules/aproba/package.json b/node_modules/aproba/package.json index ba6cb1385..e3a85f406 100644 --- a/node_modules/aproba/package.json +++ b/node_modules/aproba/package.json @@ -1,36 +1,36 @@ { - "_from": "aproba@~1.1.1", - "_id": "aproba@1.1.1", - "_integrity": "sha1-ldNgDwdxCqDpKYxyatXs8urLq6s=", + "_from": "aproba@1.1.2", + "_id": "aproba@1.1.2", + "_inBundle": false, + "_integrity": "sha512-ZpYajIfO0j2cOFTO955KUMIKNmj6zhX8kVztMAxFsDaMwz+9Z9SV0uou2pC9HJqcfpffOsjnbrDMvkNy+9RXPw==", "_location": "/aproba", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "aproba@~1.1.1", + "raw": "aproba@1.1.2", "name": "aproba", "escapedName": "aproba", - "rawSpec": "~1.1.1", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.1" + "fetchSpec": "1.1.2" }, "_requiredBy": [ + "#USER", "/", "/move-concurrently", "/move-concurrently/copy-concurrently", "/move-concurrently/run-queue", "/npmlog/gauge" ], - "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.1.tgz", - "_shasum": "95d3600f07710aa0e9298c726ad5ecf2eacbabab", - "_shrinkwrap": null, - "_spec": "aproba@~1.1.1", - "_where": "/Users/zkat/Documents/code/npm", + "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz", + "_shasum": "45c6629094de4e96f693ef7eab74ae079c240fc1", + "_spec": "aproba@1.1.2", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Rebecca Turner", "email": "me@re-becca.org" }, - "bin": null, "bugs": { "url": "https://github.com/iarna/aproba/issues" }, @@ -56,8 +56,6 @@ "license": "ISC", "main": "index.js", "name": "aproba", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/iarna/aproba.git" @@ -65,5 +63,5 @@ "scripts": { "test": "standard && tap -j3 test/*.js" }, - "version": "1.1.1" + "version": "1.1.2" } |