@crustack/utils
invariant
Catch runtime errors early by asserting expected conditions.
Usage
Configure message stripping
In your app Entrypoint, configure message stripping to avoid exposing error messages in production.
If omitted invariant will display error messages.
For Next.js or Remix applications, avoid configuring message stripping, as these frameworks already handle it in production.
Assert conditions
Use invariant to check conditions. Pass a condition and a descriptive error message. The message can be a string or a function to defer message creation until needed.