JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q42637F
  • License MIT

Tiny assertion library

Package Exports

  • claim

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (claim) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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