diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/nanoassert/README.md | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/nanoassert/README.md')
| -rw-r--r-- | node_modules/nanoassert/README.md | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/node_modules/nanoassert/README.md b/node_modules/nanoassert/README.md new file mode 100644 index 00000000..799060a5 --- /dev/null +++ b/node_modules/nanoassert/README.md @@ -0,0 +1,49 @@ +# `nanoassert` + +> Nanoscale assertion module + +## Usage + +```js +var assert = require('nanoassert') + +assert(a !== b, `${a} !== ${b}`) +``` + +## API + +### `assert(declaration, [message])` +### `assert.ok(declaration, [message])` + +Assert that `declaration` is truthy otherwise throw `Error` with +optional `message`, which defaults to `AssertionError`. +If you want friendlier messages you can use template strings to show the +assertion made like in the example above. + +### `assert.notOk(declaration, [message])` + +Assert that `declaration` is not truthy. + +### `assert.equal(a, b, [message])` + +Assert that `a` is loosely equal to `b`. Uses `==` for the comparison. + +### `assert.notEqual(a, b, [message])` + +Assert that `a` is loosely not equal to `b`. Uses `==` for the comparison. + +## Why + +I like to write public facing code very defensively, but have complaints about +the size incurred by the `assert` module. I only use the top-level `assert` +method anyway, so this should make everyone happy :) + +## Install + +```sh +npm install nanoassert +``` + +## License + +[ISC](LICENSE) |
