0.1.4 • Published 2 years ago

@dashkite/assert v0.1.4

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
2 years ago

Assert

Lightweight browser-friendly Javascript assertions.

assert isDefined foo
assert.equal foo, bar
assert.deepEqual foo, bar
assert.throws -> throw "oh no"
assert.rejects -> Promise.reject "oh no"

Features

  • ESM friendly
  • Lightweight (1.3kB in the browser)
  • Curryable
  • Plain assert takes only true — no “truth” values

Install

npm i @dashkite/assert

Reference

assert

assert condition → boolean

Returns true if condition is true, throws otherwise.

assert.equal

assert.equal expected, actual → boolean

Returns true if expected is strictly equal to actual, throws otherwise.

assert.notEqual

assert.notEqual expected, actual → boolean

Returns true if expected is strictly not equal to actual, throws otherwise.

assert.deepEqual

assert.deepEqual expected, actual → boolean

Returns true if expected is deep equal to actual, throws otherwise.

assert.notDeepEqual

assert.notDeepEqual expected, actual → boolean

Returns true if expected is not deep equal to actual, throws otherwise.

assert.throws

assert.throws function → boolean

Returns true if function throws, throws otherwise.

assert.doesNotThrow

assert.throws function → boolean

Returns true if function does not throw, throws otherwise.

assert.rejects

assert.rejects function → boolean

Returns true if function returns a promise that rejects, throws otherwise.

assert.doesNotReject

assert.rejects function → boolean

Returns true if function returns a promise that does not reject, throws otherwise.

0.1.4

2 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago