aboutsummaryrefslogtreecommitdiffhomepage
path: root/node_modules/better-assert
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/better-assert')
-rw-r--r--node_modules/better-assert/.npmignore4
-rw-r--r--node_modules/better-assert/History.md15
-rw-r--r--node_modules/better-assert/Makefile5
-rw-r--r--node_modules/better-assert/Readme.md61
-rw-r--r--node_modules/better-assert/example.js10
-rw-r--r--node_modules/better-assert/index.js38
-rw-r--r--node_modules/better-assert/package.json99
7 files changed, 232 insertions, 0 deletions
diff --git a/node_modules/better-assert/.npmignore b/node_modules/better-assert/.npmignore
new file mode 100644
index 0000000..f1250e5
--- /dev/null
+++ b/node_modules/better-assert/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
diff --git a/node_modules/better-assert/History.md b/node_modules/better-assert/History.md
new file mode 100644
index 0000000..cbb579b
--- /dev/null
+++ b/node_modules/better-assert/History.md
@@ -0,0 +1,15 @@
+
+1.0.0 / 2013-02-03
+==================
+
+ * Stop using the removed magic __stack global getter
+
+0.1.0 / 2012-10-04
+==================
+
+ * add throwing of AssertionError for test frameworks etc
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/better-assert/Makefile b/node_modules/better-assert/Makefile
new file mode 100644
index 0000000..36a3ed7
--- /dev/null
+++ b/node_modules/better-assert/Makefile
@@ -0,0 +1,5 @@
+
+test:
+ @echo "populate me"
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/better-assert/Readme.md b/node_modules/better-assert/Readme.md
new file mode 100644
index 0000000..d8d3a63
--- /dev/null
+++ b/node_modules/better-assert/Readme.md
@@ -0,0 +1,61 @@
+
+# better-assert
+
+ Better c-style assertions using [callsite](https://github.com/visionmedia/callsite) for
+ self-documenting failure messages.
+
+## Installation
+
+ $ npm install better-assert
+
+## Example
+
+ By default assertions are enabled, however the __NO_ASSERT__ environment variable
+ will deactivate them when truthy.
+
+```js
+var assert = require('better-assert');
+
+test();
+
+function test() {
+ var user = { name: 'tobi' };
+ assert('tobi' == user.name);
+ assert('number' == typeof user.age);
+}
+
+AssertionError: 'number' == typeof user.age
+ at test (/Users/tj/projects/better-assert/example.js:9:3)
+ at Object.<anonymous> (/Users/tj/projects/better-assert/example.js:4:1)
+ at Module._compile (module.js:449:26)
+ at Object.Module._extensions..js (module.js:467:10)
+ at Module.load (module.js:356:32)
+ at Function.Module._load (module.js:312:12)
+ at Module.runMain (module.js:492:10)
+ at process.startup.processNextTick.process._tickCallback (node.js:244:9)
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/better-assert/example.js b/node_modules/better-assert/example.js
new file mode 100644
index 0000000..688c29e
--- /dev/null
+++ b/node_modules/better-assert/example.js
@@ -0,0 +1,10 @@
+
+var assert = require('./');
+
+test();
+
+function test() {
+ var user = { name: 'tobi' };
+ assert('tobi' == user.name);
+ assert('number' == typeof user.age);
+} \ No newline at end of file
diff --git a/node_modules/better-assert/index.js b/node_modules/better-assert/index.js
new file mode 100644
index 0000000..fd1c9b7
--- /dev/null
+++ b/node_modules/better-assert/index.js
@@ -0,0 +1,38 @@
+/**
+ * Module dependencies.
+ */
+
+var AssertionError = require('assert').AssertionError
+ , callsite = require('callsite')
+ , fs = require('fs')
+
+/**
+ * Expose `assert`.
+ */
+
+module.exports = process.env.NO_ASSERT
+ ? function(){}
+ : assert;
+
+/**
+ * Assert the given `expr`.
+ */
+
+function assert(expr) {
+ if (expr) return;
+
+ var stack = callsite();
+ var call = stack[1];
+ var file = call.getFileName();
+ var lineno = call.getLineNumber();
+ var src = fs.readFileSync(file, 'utf8');
+ var line = src.split('\n')[lineno-1];
+ var src = line.match(/assert\((.*)\)/)[1];
+
+ var err = new AssertionError({
+ message: src,
+ stackStartFunction: stack[0].getFunction()
+ });
+
+ throw err;
+}
diff --git a/node_modules/better-assert/package.json b/node_modules/better-assert/package.json
new file mode 100644
index 0000000..49f0d7f
--- /dev/null
+++ b/node_modules/better-assert/package.json
@@ -0,0 +1,99 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "better-assert@~1.0.0",
+ "scope": null,
+ "escapedName": "better-assert",
+ "name": "better-assert",
+ "rawSpec": "~1.0.0",
+ "spec": ">=1.0.0 <1.1.0",
+ "type": "range"
+ },
+ "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/parseqs"
+ ]
+ ],
+ "_from": "better-assert@>=1.0.0 <1.1.0",
+ "_id": "better-assert@1.0.2",
+ "_inCache": true,
+ "_location": "/better-assert",
+ "_npmUser": {
+ "name": "tony_ado",
+ "email": "coolhzb@163.com"
+ },
+ "_npmVersion": "1.4.9",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "better-assert@~1.0.0",
+ "scope": null,
+ "escapedName": "better-assert",
+ "name": "better-assert",
+ "rawSpec": "~1.0.0",
+ "spec": ">=1.0.0 <1.1.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/parseqs",
+ "/parseuri"
+ ],
+ "_resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz",
+ "_shasum": "40866b9e1b9e0b55b481894311e68faffaebc522",
+ "_shrinkwrap": null,
+ "_spec": "better-assert@~1.0.0",
+ "_where": "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/parseqs",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "bugs": {
+ "url": "https://github.com/visionmedia/better-assert/issues"
+ },
+ "contributors": [
+ {
+ "name": "TonyHe",
+ "email": "coolhzb@163.com"
+ },
+ {
+ "name": "ForbesLindesay"
+ }
+ ],
+ "dependencies": {
+ "callsite": "1.0.0"
+ },
+ "description": "Better assertions for node, reporting the expr, filename, lineno etc",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "40866b9e1b9e0b55b481894311e68faffaebc522",
+ "tarball": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "homepage": "https://github.com/visionmedia/better-assert",
+ "keywords": [
+ "assert",
+ "stack",
+ "trace",
+ "debug"
+ ],
+ "main": "index",
+ "maintainers": [
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ {
+ "name": "tony_ado",
+ "email": "coolhzb@163.com"
+ }
+ ],
+ "name": "better-assert",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/visionmedia/better-assert.git"
+ },
+ "version": "1.0.2"
+}