{ "_args": [ [ { "raw": "aproba@^1.0.3", "scope": null, "escapedName": "aproba", "name": "aproba", "rawSpec": "^1.0.3", "spec": ">=1.0.3 <2.0.0", "type": "range" }, "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/gauge" ] ], "_from": "aproba@>=1.0.3 <2.0.0", "_id": "aproba@1.1.2", "_inCache": true, "_location": "/aproba", "_nodeVersion": "8.0.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/aproba-1.1.2.tgz_1496445352224_0.2260909820906818" }, "_npmUser": { "name": "iarna", "email": "me@re-becca.org" }, "_npmVersion": "5.0.1", "_phantomChildren": {}, "_requested": { "raw": "aproba@^1.0.3", "scope": null, "escapedName": "aproba", "name": "aproba", "rawSpec": "^1.0.3", "spec": ">=1.0.3 <2.0.0", "type": "range" }, "_requiredBy": [ "/gauge" ], "_resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz", "_shasum": "45c6629094de4e96f693ef7eab74ae079c240fc1", "_shrinkwrap": null, "_spec": "aproba@^1.0.3", "_where": "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/gauge", "author": { "name": "Rebecca Turner", "email": "me@re-becca.org" }, "bugs": { "url": "https://github.com/iarna/aproba/issues" }, "dependencies": {}, "description": "A rediculously light-weight argument validator", "devDependencies": { "standard": "^8.6.0", "tap": "^10.0.2" }, "directories": { "test": "test" }, "dist": { "integrity": "sha512-ZpYajIfO0j2cOFTO955KUMIKNmj6zhX8kVztMAxFsDaMwz+9Z9SV0uou2pC9HJqcfpffOsjnbrDMvkNy+9RXPw==", "shasum": "45c6629094de4e96f693ef7eab74ae079c240fc1", "tarball": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz" }, "files": [ "index.js" ], "gitHead": "52c6ebad8d130158e90cc849625a590739c6ce1f", "homepage": "https://github.com/iarna/aproba", "keywords": [ "argument", "validate" ], "license": "ISC", "main": "index.js", "maintainers": [ { "name": "iarna", "email": "me@re-becca.org" } ], "name": "aproba", "optionalDependencies": {}, "readme": "aproba\n======\n\nA ridiculously light-weight function argument validator\n\n```\nvar validate = require(\"aproba\")\n\nfunction myfunc(a, b, c) {\n // `a` must be a string, `b` a number, `c` a function\n validate('SNF', arguments) // [a,b,c] is also valid\n}\n\nmyfunc('test', 23, function () {}) // ok\nmyfunc(123, 23, function () {}) // type error\nmyfunc('test', 23) // missing arg error\nmyfunc('test', 23, function () {}, true) // too many args error\n\n```\n\nValid types are:\n\n| type | description\n| :--: | :----------\n| * | matches any type\n| A | `Array.isArray` OR an `arguments` object\n| S | typeof == string\n| N | typeof == number\n| F | typeof == function\n| O | typeof == object and not type A and not type E\n| B | typeof == boolean\n| E | `instanceof Error` OR `null` **(special: see below)**\n| Z | == `null`\n\nValidation failures throw one of three exception types, distinguished by a\n`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`.\n\nIf you pass in an invalid type then it will throw with a code of\n`EUNKNOWNTYPE`.\n\nIf an **error** argument is found and is not null then the remaining\narguments are optional. That is, if you say `ESO` then that's like using a\nnon-magical `E` in: `E|ESO|ZSO`.\n\n### But I have optional arguments?!\n\nYou can provide more than one signature by separating them with pipes `|`.\nIf any signature matches the arguments then they'll be considered valid.\n\nSo for example, say you wanted to write a signature for\n`fs.createWriteStream`. The docs for it describe it thusly:\n\n```\nfs.createWriteStream(path[, options])\n```\n\nThis would be a signature of `SO|S`. That is, a string and and object, or\njust a string.\n\nNow, if you read the full `fs` docs, you'll see that actually path can ALSO\nbe a buffer. And options can be a string, that is:\n```\npath | \noptions | \n```\n\nTo reproduce this you have to fully enumerate all of the possible\ncombinations and that implies a signature of `SO|SS|OO|OS|S|O`. The\nawkwardness is a feature: It reminds you of the complexity you're adding to\nyour API when you do this sort of thing.\n\n\n### Why this exists\n\nI wanted a very simple argument validator. It needed to do two things:\n\n1. Be more concise and easier to use than assertions\n\n2. Not encourage an infinite bikeshed of DSLs\n\nThis is why types are specified by a single character and there's no such\nthing as an optional argument. \n\nThis is not intended to validate user data. This is specifically about\nasserting the interface of your functions.\n\nIf you need greater validation, I encourage you to write them by hand or\nlook elsewhere.\n\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/iarna/aproba.git" }, "scripts": { "test": "standard && tap -j3 test/*.js" }, "version": "1.1.2" }