@fordi-org/assert

1.0.2 • Public • Published

@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.

Readme

Keywords

Package Sidebar

Install

npm i @fordi-org/assert

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

5.4 kB

Total Files

3

Last publish

Collaborators

  • fordi-org