2.0.0 • Published 8 years ago

scoped-invariant v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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!'
2.0.0

8 years ago

1.0.0

9 years ago