scoped-invariant

2.0.0 • Public • Published

scoped-invariant

A version of React's invariant() function that adds a "scope" to error messages. As with the original setting NODE_ENV to "production" allows for dead-code elimination.

var scopedInvariant = require('scoped-invariant')

var pathInvariant = scopedInvariant('path')

pathInvariant(false, "failed!") // throws '[path] Invariant Violation: failed!'

scopedInvariant('my-module')(false, "failed!") // throws '[my-module] Invariant Violation: failed!'

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i scoped-invariant

Weekly Downloads

1

Version

2.0.0

License

MIT

Last publish

Collaborators

  • monastic.panic