# @fordi-org/assert

> Wrapper around node:assert for custom assertions

Latest version **1.0.2** (published 2024-01-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install @fordi-org/assert
pnpm add @fordi-org/assert
yarn add @fordi-org/assert
bun add @fordi-org/assert
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2024-01-19 |
| First published | 2024-01-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bryan Elliott |
| Maintainers | fordi-org |
| Keywords | test, assert, epsilon |

## Links

- npm: https://www.npmjs.com/package/@fordi-org/assert
- Repository: https://github.com/Fordi/assert
- Homepage: https://github.com/Fordi/assert#readme
- Issues: https://github.com/Fordi/assert/issues
- npm.io page: https://npm.io/package/@fordi-org/assert

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2024-01-19
- 1.0.1 — 2024-01-19
- 1.0.0 — 2024-01-19

## README

# @fordi-org/assert

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

## sameType

Assert that two items are the same type.

```javascript
assert.sameType(actual, expected, message)
```


## sameLength

Assert that two objects have the same length.

```javascript
assert.sameLength(actual, expected, message);
```

## closeTo

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

```javascript
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.

```javascript
const deepCustomAssertion = deeply(customAssertion);
```

## deepCloseTo

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

Same as [assert.closeTo](#closeTo), but recursive.

---
_Source: https://npm.io/package/@fordi-org/assert · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
