@kivixeletric/that-is v1.0.5
That-isis a utility javascript library for type checking, the purpose of the project is to help with flexibility and code optimization.
> Installation
You can use the library using a latest version on github or via npm (the recommended way):
npm install @kivixeletric/that-is> How to use
To use the library in your project is very simple, see the example below:
import is from '@kivixeletric/that-is'
// Number Type
is.number('0') // will return a False
is.number(0) // will return a True
// String Type
is.string('boo') // will return a True
is.string(true) // will return a FalseBut if you want to do multiple checks of the same type, see the example below:
is.number(1, '2') // False
is.number(1, 2) // True
is.number(1, '2', 3) // False
is.number(1, 2, 3) // TrueBut some functions will not have multiple values, for example is.divisible and is.equal
> Type List
~ Logical Types
typeora- (type, ...values) -> Checks if value is a selected typedefinedordef- (...values) -> Checks if value is defined (is also applied to Object types)typeEquals- (value1, value2) -> Checks if typeof value is equals a other typeof valueequals- (value1, value2) -> Checks if value is equals a other value
~ Numeric Types
decimal- (...values) -> Checks if value is decimal typebigint- (...values) -> Checks if value is bigint typedivisible- (value, number) -> Checks if value is divisible with another numberinfinite- (...values) -> Checks if value is a infinite type
~ Object Types
elementorelemornode- (...values) -> Checks if value is node element typeobjectorobj- (...values) -> Checks if value is object typearrayorarr- (...values) -> Checks if value is array type
~ Natural Types
number,numorint- (...values) -> Checks if value is number typestringorstr- (...values) -> Checks if value is string typebooleanorbool- (...values) -> Checks if value is boolean typefunctionorfn- (...values) -> Checks if value is function typesymbol- (...values) -> Checks if value is symbol type
~ Special Types
regexp- (...values) -> Checks if value is RegExp type
> License
- This project is licensed under MIT License