likern / react-native-invariant

invariant and assert functions with types for React Native :star:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

invariant and assert functions with types for React Native :star:

License:Apache License 2.0


Languages

Language:TypeScript 73.1%Language:JavaScript 26.9%