# purify-invariant

> An invariant utility for use alongside purify-ts.

Latest version **0.0.12** (published 2022-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install purify-invariant
pnpm add purify-invariant
yarn add purify-invariant
bun add purify-invariant
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2022-05-19 |
| First published | 2022-05-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Brandon Pittman |
| Maintainers | brandonpittman |
| Keywords | typescript, purify-ts, invariant |

## Links

- npm: https://www.npmjs.com/package/purify-invariant
- Repository: https://github.com/brandonpittman/purify-invariant
- Homepage: https://github.com/brandonpittman/purify-invariant#readme
- Issues: https://github.com/brandonpittman/purify-invariant/issues
- npm.io page: https://npm.io/package/purify-invariant

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.12 (latest) — 2022-05-19
- 0.0.12-3 (next) — 2022-05-19
- 0.0.12-2 — 2022-05-19
- 0.0.12-1 — 2022-05-19
- 0.0.12-0 — 2022-05-19
- 0.0.10-0 — 2022-05-19
- 0.0.9 — 2022-05-19
- 0.0.8 — 2022-05-19
- 0.0.7 — 2022-05-19
- 0.0.6 — 2022-05-19
- 0.0.4 — 2022-05-12
- 0.0.3 — 2022-05-11
- 0.0.2 — 2022-05-11
- 0.0.1 — 2022-05-10

## README

# purify-invariant

This is a semi-clone of tiny-invariant. It is meant to be used alongside
purify-ts. The condition assert uses Purify's `Maybe.fromFalsy`. This could be
seen as total overkill, but it leaves room to add interesting stuff in the
future.

What is fun about this package now, is that you can pass a `strategy` param to
the `invariant` function of `"throw" | "log" | "warn" | "error"`. `throw` is
the default but if you just want to use `console.${strategy}`, it's easy to
switch up.

## Install

```sh
npm install purify-invariant
```

## Example

```ts
// Unlike tiny-invariant, the error message is required.
invariant(1 > 2); // will throw an error

// Okay
invariant(1 > 2, "Condition check failed");

invariant(1 > 2, "Condition check failed", "warn");
```

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