summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/aproba
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2016-06-03 11:08:53 -0700
committerMyles Borins <mborins@us.ibm.com>2016-06-06 15:27:52 -0700
commit843d58fcbbec09cde5633e0bc5ab025d0a640204 (patch)
tree0c866d93e1bd243b18baccc59eca99bcef048274 /deps/npm/node_modules/aproba
parenta32f7eb4bec1eb08f271d63f9f99dc322a6e1b6d (diff)
downloadandroid-node-v8-843d58fcbbec09cde5633e0bc5ab025d0a640204.tar.gz
android-node-v8-843d58fcbbec09cde5633e0bc5ab025d0a640204.tar.bz2
android-node-v8-843d58fcbbec09cde5633e0bc5ab025d0a640204.zip
deps: upgrade npm to 3.9.5
PR-URL: https://github.com/nodejs/node/pull/7139 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/aproba')
-rw-r--r--deps/npm/node_modules/aproba/README.md2
-rw-r--r--deps/npm/node_modules/aproba/index.js53
-rw-r--r--deps/npm/node_modules/aproba/package.json110
-rw-r--r--deps/npm/node_modules/aproba/test/index.js86
4 files changed, 148 insertions, 103 deletions
diff --git a/deps/npm/node_modules/aproba/README.md b/deps/npm/node_modules/aproba/README.md
index e5c1f5595b..44e2263c2f 100644
--- a/deps/npm/node_modules/aproba/README.md
+++ b/deps/npm/node_modules/aproba/README.md
@@ -23,7 +23,7 @@ Valid types are:
type | description
---- | -----------
* | matches any type
-A | instanceof Array OR an arguments object
+A | Array.isArray OR an arguments object
S | typeof == string
N | typeof == number
F | typeof == function
diff --git a/deps/npm/node_modules/aproba/index.js b/deps/npm/node_modules/aproba/index.js
index 7d8ff07f87..6d1c17ece9 100644
--- a/deps/npm/node_modules/aproba/index.js
+++ b/deps/npm/node_modules/aproba/index.js
@@ -1,51 +1,56 @@
-"use strict"
+'use strict'
var types = {
- "*": ["any", function () { return true }],
- A: ["array", function (thingy) { return thingy instanceof Array || (typeof thingy === "object" && thingy.hasOwnProperty("callee")) }],
- S: ["string", function (thingy) { return typeof thingy === "string" }],
- N: ["number", function (thingy) { return typeof thingy === "number" }],
- F: ["function", function (thingy) { return typeof thingy === "function" }],
- O: ["object", function (thingy) { return typeof thingy === "object" && !types.A[1](thingy) && !types.E[1](thingy) }],
- B: ["boolean", function (thingy) { return typeof thingy == "boolean" }],
- E: ["error", function (thingy) { return thingy instanceof Error }]
+ '*': ['any', function () { return true }],
+ A: ['array', function (thingy) { return (Array.isArray && Array.isArray(thingy)) || (typeof thingy === 'object' && thingy.hasOwnProperty('callee')) }],
+ S: ['string', function (thingy) { return typeof thingy === 'string' }],
+ N: ['number', function (thingy) { return typeof thingy === 'number' }],
+ F: ['function', function (thingy) { return typeof thingy === 'function' }],
+ O: ['object', function (thingy) { return typeof thingy === 'object' && !types.A[1](thingy) && !types.E[1](thingy) }],
+ B: ['boolean', function (thingy) { return typeof thingy === 'boolean' }],
+ E: ['error', function (thingy) { return thingy instanceof Error }]
}
var validate = module.exports = function (schema, args) {
- if (!schema) throw missingRequiredArg(0, "schema")
- if (!args) throw missingRequiredArg(1, "args")
- if (!types.S[1](schema)) throw invalidType(0, "string", schema)
- if (!types.A[1](args)) throw invalidType(1, "array", args)
+ if (!schema) throw missingRequiredArg(0, 'schema')
+ if (!args) throw missingRequiredArg(1, 'args')
+ if (!types.S[1](schema)) throw invalidType(0, 'string', schema)
+ if (!types.A[1](args)) throw invalidType(1, 'array', args)
for (var ii = 0; ii < schema.length; ++ii) {
var type = schema[ii]
if (!types[type]) throw unknownType(ii, type)
var typeLabel = types[type][0]
var typeCheck = types[type][1]
- if (type === "E" && args[ii] == null) continue
+ if (type === 'E' && args[ii] == null) continue
if (args[ii] == null) throw missingRequiredArg(ii)
if (!typeCheck(args[ii])) throw invalidType(ii, typeLabel, args[ii])
- if (type === "E") return
+ if (type === 'E') return
}
if (schema.length < args.length) throw tooManyArgs(schema.length, args.length)
}
-function missingRequiredArg(num) {
- return newException("EMISSINGARG", "Missing required argument #"+(num+1))
+function missingRequiredArg (num) {
+ return newException('EMISSINGARG', 'Missing required argument #' + (num + 1))
}
-function unknownType(num, type) {
- return newException("EUNKNOWNTYPE", "Unknown type "+type+" in argument #"+(num+1))
+function unknownType (num, type) {
+ return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1))
}
-function invalidType(num, type, value) {
- return newException("EINVALIDTYPE", "Argument #"+(num+1)+": Expected "+type+" but got "+typeof value)
+function invalidType (num, expectedType, value) {
+ var valueType
+ Object.keys(types).forEach(function (typeCode) {
+ if (types[typeCode][1](value)) valueType = types[typeCode][0]
+ })
+ return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' +
+ expectedType + ' but got ' + valueType)
}
-function tooManyArgs(expected, got) {
- return newException("ETOOMANYARGS", "Too many arguments, expected "+expected+" and got "+got)
+function tooManyArgs (expected, got) {
+ return newException('ETOOMANYARGS', 'Too many arguments, expected ' + expected + ' and got ' + got)
}
-function newException(code, msg) {
+function newException (code, msg) {
var e = new Error(msg)
e.code = code
Error.captureStackTrace(e, validate)
diff --git a/deps/npm/node_modules/aproba/package.json b/deps/npm/node_modules/aproba/package.json
index b41acdf973..56452c4067 100644
--- a/deps/npm/node_modules/aproba/package.json
+++ b/deps/npm/node_modules/aproba/package.json
@@ -1,54 +1,92 @@
{
- "name": "aproba",
- "version": "1.0.1",
- "description": "A rediculously light-weight argument validator",
- "main": "index.js",
- "directories": {
- "test": "test"
+ "_args": [
+ [
+ {
+ "name": "aproba",
+ "raw": "aproba@latest",
+ "rawSpec": "latest",
+ "scope": null,
+ "spec": "latest",
+ "type": "tag"
+ },
+ "/Users/zkat/Documents/code/npm"
+ ]
+ ],
+ "_from": "aproba@latest",
+ "_id": "aproba@1.0.3",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/aproba",
+ "_nodeVersion": "4.4.0",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/aproba-1.0.3.tgz_1463784729571_0.7574592484161258"
+ },
+ "_npmUser": {
+ "email": "me@re-becca.org",
+ "name": "iarna"
+ },
+ "_npmVersion": "3.9.2",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "aproba",
+ "raw": "aproba@latest",
+ "rawSpec": "latest",
+ "scope": null,
+ "spec": "latest",
+ "type": "tag"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.0.3.tgz",
+ "_shasum": "7fb6da3a72c70249db63fd9b5c64b31af718a94f",
+ "_shrinkwrap": null,
+ "_spec": "aproba@latest",
+ "_where": "/Users/zkat/Documents/code/npm",
+ "author": {
+ "email": "me@re-becca.org",
+ "name": "Rebecca Turner"
+ },
+ "bugs": {
+ "url": "https://github.com/iarna/aproba/issues"
},
"dependencies": {},
+ "description": "A rediculously light-weight argument validator",
"devDependencies": {
- "tap": "^0.7.0"
+ "standard": "^7.1.0",
+ "tap": "^5.7.1"
},
- "scripts": {
- "test": "tap test/*.js"
+ "directories": {
+ "test": "test"
},
- "repository": {
- "type": "git",
- "url": "https://github.com/iarna/aproba"
+ "dist": {
+ "shasum": "7fb6da3a72c70249db63fd9b5c64b31af718a94f",
+ "tarball": "https://registry.npmjs.org/aproba/-/aproba-1.0.3.tgz"
},
+ "gitHead": "20cc4fc6589bbf870c3ca7bb8b9cb203af9d96a5",
+ "homepage": "https://github.com/iarna/aproba",
"keywords": [
"argument",
"validate"
],
- "author": {
- "name": "Rebecca Turner",
- "email": "me@re-becca.org"
- },
"license": "ISC",
- "bugs": {
- "url": "https://github.com/iarna/aproba/issues"
- },
- "homepage": "https://github.com/iarna/aproba",
- "gitHead": "a2ea029793a14cddb9457afd0a83dc421889c7ad",
- "_id": "aproba@1.0.1",
- "_shasum": "c4ac2cc5becfb8b099de7ef9f02790e7d32d99ef",
- "_from": "aproba@>=1.0.1 <1.1.0",
- "_npmVersion": "2.7.5",
- "_nodeVersion": "1.6.2",
- "_npmUser": {
- "name": "iarna",
- "email": "me@re-becca.org"
- },
+ "main": "index.js",
"maintainers": [
{
- "name": "iarna",
- "email": "me@re-becca.org"
+ "email": "me@re-becca.org",
+ "name": "iarna"
}
],
- "dist": {
- "shasum": "c4ac2cc5becfb8b099de7ef9f02790e7d32d99ef",
- "tarball": "http://registry.npmjs.org/aproba/-/aproba-1.0.1.tgz"
+ "name": "aproba",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/iarna/aproba.git"
+ },
+ "scripts": {
+ "test": "standard && tap test/*.js"
},
- "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.0.1.tgz"
+ "version": "1.0.3"
}
diff --git a/deps/npm/node_modules/aproba/test/index.js b/deps/npm/node_modules/aproba/test/index.js
index 0574709c8f..b96fd4216e 100644
--- a/deps/npm/node_modules/aproba/test/index.js
+++ b/deps/npm/node_modules/aproba/test/index.js
@@ -1,85 +1,87 @@
-"use strict"
-var test = require("tap").test
-var validate = require("../index.js")
+'use strict'
+var test = require('tap').test
+var validate = require('../index.js')
function thrown (t, code, msg, todo) {
- validate("OSSF", arguments)
+ validate('OSSF', arguments)
try {
todo()
t.fail(msg)
- }
- catch (e) {
+ } catch (e) {
t.is(e.code, code, msg + e.message)
}
}
function notThrown (t, msg, todo) {
- validate("OSF", arguments)
+ validate('OSF', arguments)
try {
todo()
t.pass(msg)
- }
- catch (e) {
- t.fail(msg+"\n"+e.stack)
+ } catch (e) {
+ t.fail(msg + '\n' + e.stack)
}
}
-test("general", function (t) {
- t.plan(69)
+test('general', function (t) {
+ t.plan(70)
var values = {
- "A": [],
- "S": "test",
- "N": 123,
- "F": function () {},
- "O": {},
- "B": false,
- "E": new Error()
+ 'A': [],
+ 'S': 'test',
+ 'N': 123,
+ 'F': function () {},
+ 'O': {},
+ 'B': false,
+ 'E': new Error()
}
Object.keys(values).forEach(function (type) {
Object.keys(values).forEach(function (contraType) {
if (type === contraType) {
- notThrown(t, type + " matches " + contraType, function () {
+ notThrown(t, type + ' matches ' + contraType, function () {
validate(type, [values[contraType]])
})
- }
- else {
- thrown(t, "EINVALIDTYPE", type + " does not match " + contraType, function () {
+ } else {
+ thrown(t, 'EINVALIDTYPE', type + ' does not match ' + contraType, function () {
validate(type, [values[contraType]])
})
}
})
- if (type === "E") {
- notThrown(t, "null is ok for E", function () {
+ if (type === 'E') {
+ notThrown(t, 'null is ok for E', function () {
validate(type, [null])
})
- }
- else {
- thrown(t, "EMISSINGARG", "null not ok for "+type, function () {
+ } else {
+ thrown(t, 'EMISSINGARG', 'null not ok for ' + type, function () {
validate(type, [null])
})
}
})
Object.keys(values).forEach(function (contraType) {
- notThrown(t, "* matches " + contraType, function () {
- validate("*", [values[contraType]])
+ notThrown(t, '* matches ' + contraType, function () {
+ validate('*', [values[contraType]])
})
})
- thrown(t, "EMISSINGARG", "not enough args", function () {
- validate("SNF", ["abc", 123])
+ thrown(t, 'EMISSINGARG', 'not enough args', function () {
+ validate('SNF', ['abc', 123])
})
- thrown(t, "ETOOMANYARGS", "too many args", function () {
- validate("SNF", ["abc", 123, function () {}, true])
+ thrown(t, 'ETOOMANYARGS', 'too many args', function () {
+ validate('SNF', ['abc', 123, function () {}, true])
})
- notThrown(t, "E matches null", function () {
- validate("E", [null])
+ notThrown(t, 'E matches null', function () {
+ validate('E', [null])
})
- notThrown(t, "E matches undefined", function () {
- validate("E", [undefined])
+ notThrown(t, 'E matches undefined', function () {
+ validate('E', [undefined])
})
- notThrown(t, "E w/ error requires nothing else", function () {
- validate("ESN", [new Error(), "foo"])
+ notThrown(t, 'E w/ error requires nothing else', function () {
+ validate('ESN', [new Error(), 'foo'])
})
- thrown(t, "EMISSINGARG", "E w/o error works as usual", function () {
- validate("ESN", [null, "foo"])
+ thrown(t, 'EMISSINGARG', 'E w/o error works as usual', function () {
+ validate('ESN', [null, 'foo'])
})
+ try {
+ validate('O', [[]])
+ t.fail('object != array')
+ } catch (ex) {
+ t.match(ex.message, /Expected object but got array/, 'When reporting non-objects, uses aproba types')
+ }
})