{ "_args": [ [ { "raw": "assert-plus@^1.0.0", "scope": null, "escapedName": "assert-plus", "name": "assert-plus", "rawSpec": "^1.0.0", "spec": ">=1.0.0 <2.0.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/http-signature" ] ], "_from": "assert-plus@>=1.0.0 <2.0.0", "_id": "assert-plus@1.0.0", "_inCache": true, "_location": "/assert-plus", "_nodeVersion": "0.10.40", "_npmUser": { "name": "pfmooney", "email": "patrick.f.mooney@gmail.com" }, "_npmVersion": "3.3.9", "_phantomChildren": {}, "_requested": { "raw": "assert-plus@^1.0.0", "scope": null, "escapedName": "assert-plus", "name": "assert-plus", "rawSpec": "^1.0.0", "spec": ">=1.0.0 <2.0.0", "type": "range" }, "_requiredBy": [ "/dashdash", "/getpass", "/http-signature", "/jsprim", "/sshpk", "/verror" ], "_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "_shasum": "f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525", "_shrinkwrap": null, "_spec": "assert-plus@^1.0.0", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/http-signature", "author": { "name": "Mark Cavage", "email": "mcavage@gmail.com" }, "bugs": { "url": "https://github.com/mcavage/node-assert-plus/issues" }, "contributors": [ { "name": "Dave Eddy", "email": "dave@daveeddy.com" }, { "name": "Fred Kuo", "email": "fred.kuo@joyent.com" }, { "name": "Lars-Magnus Skog", "email": "ralphtheninja@riseup.net" }, { "name": "Mark Cavage", "email": "mcavage@gmail.com" }, { "name": "Patrick Mooney", "email": "pmooney@pfmooney.com" }, { "name": "Rob Gulewich", "email": "robert.gulewich@joyent.com" } ], "dependencies": {}, "description": "Extra assertions on top of node's assert module", "devDependencies": { "faucet": "0.0.1", "tape": "4.2.2" }, "directories": {}, "dist": { "shasum": "f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525", "tarball": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" }, "engines": { "node": ">=0.8" }, "homepage": "https://github.com/mcavage/node-assert-plus#readme", "license": "MIT", "main": "./assert.js", "maintainers": [ { "name": "mcavage", "email": "mcavage@gmail.com" }, { "name": "pfmooney", "email": "patrick.f.mooney@gmail.com" } ], "name": "assert-plus", "optionalDependencies": {}, "readme": "# assert-plus\n\nThis library is a super small wrapper over node's assert module that has two\nthings: (1) the ability to disable assertions with the environment variable\nNODE\\_NDEBUG, and (2) some API wrappers for argument testing. Like\n`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks\nlike this:\n\n```javascript\n var assert = require('assert-plus');\n\n function fooAccount(options, callback) {\n assert.object(options, 'options');\n assert.number(options.id, 'options.id');\n assert.bool(options.isManager, 'options.isManager');\n assert.string(options.name, 'options.name');\n assert.arrayOfString(options.email, 'options.email');\n assert.func(callback, 'callback');\n\n // Do stuff\n callback(null, {});\n }\n```\n\n# API\n\nAll methods that *aren't* part of node's core assert API are simply assumed to\ntake an argument, and then a string 'name' that's not a message; `AssertionError`\nwill be thrown if the assertion fails with a message like:\n\n AssertionError: foo (string) is required\n at test (/home/mark/work/foo/foo.js:3:9)\n at Object. (/home/mark/work/foo/foo.js:15:1)\n at Module._compile (module.js:446:26)\n at Object..js (module.js:464:10)\n at Module.load (module.js:353:31)\n at Function._load (module.js:311:12)\n at Array.0 (module.js:484:10)\n at EventEmitter._tickCallback (node.js:190:38)\n\nfrom:\n\n```javascript\n function test(foo) {\n assert.string(foo, 'foo');\n }\n```\n\nThere you go. You can check that arrays are of a homogeneous type with `Arrayof$Type`:\n\n```javascript\n function test(foo) {\n assert.arrayOfString(foo, 'foo');\n }\n```\n\nYou can assert IFF an argument is not `undefined` (i.e., an optional arg):\n\n```javascript\n assert.optionalString(foo, 'foo');\n```\n\nLastly, you can opt-out of assertion checking altogether by setting the\nenvironment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have\nlots of assertions, and don't want to pay `typeof ()` taxes to v8 in\nproduction. Be advised: The standard functions re-exported from `assert` are\nalso disabled in assert-plus if NDEBUG is specified. Using them directly from\nthe `assert` module avoids this behavior.\n\nThe complete list of APIs is:\n\n* assert.array\n* assert.bool\n* assert.buffer\n* assert.func\n* assert.number\n* assert.finite\n* assert.object\n* assert.string\n* assert.stream\n* assert.date\n* assert.regexp\n* assert.uuid\n* assert.arrayOfArray\n* assert.arrayOfBool\n* assert.arrayOfBuffer\n* assert.arrayOfFunc\n* assert.arrayOfNumber\n* assert.arrayOfFinite\n* assert.arrayOfObject\n* assert.arrayOfString\n* assert.arrayOfStream\n* assert.arrayOfDate\n* assert.arrayOfRegexp\n* assert.arrayOfUuid\n* assert.optionalArray\n* assert.optionalBool\n* assert.optionalBuffer\n* assert.optionalFunc\n* assert.optionalNumber\n* assert.optionalFinite\n* assert.optionalObject\n* assert.optionalString\n* assert.optionalStream\n* assert.optionalDate\n* assert.optionalRegexp\n* assert.optionalUuid\n* assert.optionalArrayOfArray\n* assert.optionalArrayOfBool\n* assert.optionalArrayOfBuffer\n* assert.optionalArrayOfFunc\n* assert.optionalArrayOfNumber\n* assert.optionalArrayOfFinite\n* assert.optionalArrayOfObject\n* assert.optionalArrayOfString\n* assert.optionalArrayOfStream\n* assert.optionalArrayOfDate\n* assert.optionalArrayOfRegexp\n* assert.optionalArrayOfUuid\n* assert.AssertionError\n* assert.fail\n* assert.ok\n* assert.equal\n* assert.notEqual\n* assert.deepEqual\n* assert.notDeepEqual\n* assert.strictEqual\n* assert.notStrictEqual\n* assert.throws\n* assert.doesNotThrow\n* assert.ifError\n\n# Installation\n\n npm install assert-plus\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2012 Mark Cavage\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Bugs\n\nSee .\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/mcavage/node-assert-plus.git" }, "scripts": { "test": "tape tests/*.js | ./node_modules/.bin/faucet" }, "version": "1.0.0" }