1.0.0 • Published 4 years ago

@breeffy/react-native-invariant v1.0.0

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
4 years ago

React Native Invariant

npm npm

invariant and assert functions with types for React Native.

Overview

Two functions with the same signatures are provided.

invariant(condition, message, prefix) and assert(condition, message, prefix).

The only difference is in default prefix value.

@param condition, type: any, description: If it's falsy - exception will be thrown, otherwise TypeScript asserts condition. See Assertion Functions.

@param message, type: string | undefined, description: Error message to use if exception will be thrown. Default is "".

@param prefix, type: string | undefined, description: Prefix string to use before error message if exception will be thrown. For assert default is "[assert] ", for invariant default is "[invariant] ".

License

react-native-invariant is licensed under Apache-2.0 license.

Copyright © 2021, Victor Malov.