0.0.12 • Published 2 years ago

purify-invariant v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

npm install purify-invariant

Example

// 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");
0.0.12-1

2 years ago

0.0.12-0

2 years ago

0.0.12-3

2 years ago

0.0.12-2

2 years ago

0.0.12

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.10-0

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago