claim
Tiny assertion library
Last updated 11 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install claim 
SYNC missed versions from official npm registry.

claim Build Status

Tiny assertion library

Install

$ npm install --save claim

Usage

var claim = require('claim');

claim.true(true);
claim.false(false);
claim.is('foo', 'foo');
claim.not('foo', 'bar');
claim.same(['a', 'b'], ['a', 'b']);
claim.notSame({a: 'a'}, {a: 'b'});
claim.regexTest(/^abc$/, 'abc');

API

.pass([message])

Passing assertion.

.fail([message])

Failing assertion.

.ok(value, [message])

Assert that value is truthy.

.notOk(value, [message])

Assert that value is falsy.

.true(value, [message])

Assert that value is true.

.false(value, [message])

Assert that value is false.

.is(value, expected, [message])

Assert that value is equal to expected.

.not(value, expected, [message])

Assert that value is not equal to expected.

.same(value, expected, [message])

Assert that value is deep equal to expected.

.notSame(value, expected, [message])

Assert that value is not deep equal to expected.

.throws(function, error, [message])

Assert that function throws an error.

error can be a constructor, regex or validation function.

.doesNotThrow(function, [message])

Assert that function doesn't throw an error.

.regexTest(regex, contents, [message])

Assert that regex matches contents.

.ifError(error, [message])

Assert that error is falsy.

License

MIT © Kevin Mårtensson

Current Tags

  • 1.4.0                                ...           latest (11 years ago)

6 Versions

  • 1.4.0                                ...           11 years ago
  • 1.3.0                                ...           11 years ago
  • 1.2.0                                ...           11 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.1                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |