UNPKG

pimatic

Version:

A home automation server and framework for the Raspberry PI running on node.js

38 lines (37 loc) 4.63 kB
{ "name": "cassert", "version": "0.1.2", "author": { "name": "Johan Sköld", "email": "johan@skold.cc" }, "description": "C-style assert for javascript and coffee-script, in node.", "main": "index.js", "repository": { "type": "git", "url": "git+https://github.com/rhoot/cassert.git" }, "keywords": [ "assert", "debug" ], "dependencies": { "callsite": "~1.0.0", "source-map-support": "^0.4.0" }, "license": "BSD", "engines": { "node": ">= 4" }, "gitHead": "5d5081badace39512775d174a88318ca27b78778", "readme": "\n# cassert\n\nC-style assertions for javascript and coffee-script, running in node.js.\nExtracts assertion failure messages from the expressions themselves. Based on\n[better-assert](https://github.com/visionmedia/better-assert).\n\n## Installation\n\n npm install cassert\n\n## Usage\n\nRequire the module and use it as an assert function, [just as you would in C](http://www.cplusplus.com/reference/cassert/assert/). As long as the NODE_ENV\nenvironment variable is not set to `production`, cassert will perform the\ncheck. Note that for coffee-script, the assert failure message will show the\ncompiled javascript expression.\n\n**Important:** The assert function must be invoked as `assert(expression)`,\n`cassert(expression)`, or similar name ending on `assert`.\n\n## Javascript Example\n\n```js\nvar assert = require('cassert');\n\nfunction foo(bar) {\n assert(typeof bar === 'number');\n assert(bar > 10);\n}\n\nfoo(5);\n```\n\n```\nAssertionError: bar > 10\n at foo (d:\\git\\cassert\\test.js:5:5)\n at Object.<anonymous> (d:\\git\\cassert\\test.js:8:1)\n at Module._compile (module.js:449:26)\n at Object.Module._extensions..js (module.js:467:10)\n at Module.load (module.js:356:32)\n at Function.Module._load (module.js:312:12)\n at Module.runMain (module.js:492:10)\n at process.startup.processNextTick.process._tickCallback (node.js:244:9)\n```\n\n## CoffeeScript Example\n\n```coffee\nassert = require 'cassert'\n\nfoo = (bar) ->\n assert typeof bar is 'number'\n assert bar > 10\n\nfoo 5\n```\n\n```\nAssertionError: bar > 10\n at foo (d:\\git\\cassert\\test.coffee:8:12)\n at Object.<anonymous> (d:\\git\\cassert\\test.coffee:11:3)\n at Object.<anonymous> (d:\\git\\cassert\\test.coffee:13:4)\n at Module._compile (module.js:449:26)\n at Object.exports.run (c:\\Users\\Johan\\AppData\\Roaming\\npm\\node_modules\\coffee-script\\lib\\coffee-script\\coffee-script.js:83:25)\n at compileScript (c:\\Users\\Johan\\AppData\\Roaming\\npm\\node_modules\\coffee-script\\lib\\coffee-script\\command.js:177:29)\n at fs.stat.notSources.(anonymous function) (c:\\Users\\Johan\\AppData\\Roaming\\npm\\node_modules\\coffee-script\\lib\\coffee-script\\command.js:152:18)\n at fs.readFile (fs.js:176:14)\n at Object.oncomplete (fs.js:297:15)\n```\n\n## License (BSD)\n\nCopyright (c) 2013, Johan Sköld &lt;johan@skold.cc&gt; \nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or\nother materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/rhoot/cassert/issues" }, "homepage": "https://github.com/rhoot/cassert#readme", "_id": "cassert@0.1.2", "_shasum": "6b523965982392e9150067d158b26f5a02ac3535", "_from": "pimatic/cassert#master", "_resolved": "git://github.com/pimatic/cassert.git#5d5081badace39512775d174a88318ca27b78778" }