1.0.2 • Published 5 months ago

@fordi-org/assert v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

@fordi-org/assert

A wrapper around node:assert where I keep custom assertions.

sameType

Assert that two items are the same type.

assert.sameType(actual, expected, message)

sameLength

Assert that two objects have the same length.

assert.sameLength(actual, expected, message);

closeTo

Assert that two numbers are close to one another within some tolerance.

assert.closeTo(actual, expected, epsilon, message);

The default tolerance is an epsilon of 1e-15; you can change the default by setting assert.closeTo.defaultEpsilon.

deeply

Create an assertion that applies recursively to objects / arrays.

const deepCustomAssertion = deeply(customAssertion);

deepCloseTo

assert.deepCloseTo(actual, expected, epsilon, message);

Same as assert.closeTo, but recursive.

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago