Package Exports
- outvariant
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (outvariant) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
outvariant
Why?
- Type-safe implementation of invariant. Asserts the given predicate expression so it's treated as non-nullable after the
invariantcall:
// Regular "invariant":
invariant(user, 'Failed to fetch')
user?.firstName // "user" is possibly undefined
// The glorious "outvariant":
invariant(user, 'Failed to fetch')
user.firstName // OK, "user" exists at this point- Positionals support.
invariant(predicate, 'Expected %s but got %s', 'one', false)Getting started
npm install outvariant
# or
yarn add outvariantimport { invariant } from 'outvariant'
invariant(user, 'Failed to load: expected user, but got %o', user)