# @arpinum/defender

> Assertions to do some runtime type checking

Latest version **1.0.7** (published 2024-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @arpinum/defender
pnpm add @arpinum/defender
yarn add @arpinum/defender
bun add @arpinum/defender
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2024-03-06 |
| First published | 2018-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Arpinum |
| Maintainers | michaelborde |
| Keywords | assert, validate, ensure, contract |

## Links

- npm: https://www.npmjs.com/package/@arpinum/defender
- Repository: https://github.com/arpinum-oss/js-defender
- Homepage: https://github.com/arpinum-oss/js-defender#readme
- Issues: https://github.com/arpinum-oss/js-defender/issues
- npm.io page: https://npm.io/package/@arpinum/defender

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2024-03-06
- 1.0.6 — 2022-08-20
- 1.0.4 — 2022-01-07
- 1.0.3 — 2020-10-23
- 1.0.2 — 2020-03-24
- 1.0.1 — 2019-04-19
- 1.0.0 — 2018-04-18
- 0.0.5 — 2018-04-17
- 0.0.4 — 2018-04-13
- 0.0.3 — 2018-04-13
- 0.0.2 — 2018-04-12
- 0.0.1 — 2018-04-12

## README

# @arpinum/defender [![Build Status](https://github.com/arpinum-oss/js-defender/workflows/CI/badge.svg)](https://github.com/arpinum-oss/js-defender/actions?query=workflow%3ACI)

> Every absurdity has a champion to defend it.  
> <cite>Oliver Goldsmith</cite>

_@arpinum/defender_ is a collection of assertions to do some runtime type checking.

## Installation

```
npm install @arpinum/defender --save
```

## Examples

Assertion throwing exception when not satisfied:

```ts
import { assert } from "@arpinum/defender";

assert("hello").toBeANumber(); // throws: value must be a number
```

Simple validation returning a boolean:

```ts
import { is } from "@arpinum/defender";

is("hello").aNumber(); // false
```

More examples in [examples](examples).

## Docs

- [API](docs/api.md)

## License

[MIT](LICENSE)

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