That-isis a utility javascript library for type checking, the purpose of the project is to help with flexibility and code optimization
The project is designed to support both Node and Web environments, follow the instructions below to install:
-
-
Download the latest version for the web distribution
-
Place the
.jsor.min.jsfile from the.zipinside your project -
After you have placed the file, place the following code in your
.htmlfile:<script src="path/to/That-is.js"></script>
-
Note: all tools will be present in
window.is.
-
-
-
Use the platform npm to install the library:
npm install @kivixeletric/that-is -
After installation, you can use the library with
requireas in the example below:var is = require('@kivixeletric/that-is')
but if you write in
TypeScriptand like to use the ESM system, then you can use this method:import is from '@kivixeletric/that-is'
-
To use the library in your project is very simple, see the example below:
// 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
-
typeora- (type, ...values) -> Checks if value is a selected type -
definedordef- (...values) -> Checks if value is defined (is also applied to Object types) -
typeEquals- (value1, value2) -> Checks if typeof value is equals a other typeof value -
equals- (value1, value2) -> Checks if value is equals a other value
-
decimal- (...values) -> Checks if value is decimal type -
bigint- (...values) -> Checks if value is bigint type -
divisible- (value, number) -> Checks if value is divisible with another number -
infinite- (...values) -> Checks if value is a infinite type
-
elementorelemornode- (...values) -> Checks if value is node element type -
objectorobj- (...values) -> Checks if value is object type -
arrayorarr- (...values) -> Checks if value is array type
-
number,numorint- (...values) -> Checks if value is number type -
stringorstr- (...values) -> Checks if value is string type -
booleanorbool- (...values) -> Checks if value is boolean type -
functionorfn- (...values) -> Checks if value is function type -
symbol- (...values) -> Checks if value is symbol type
regexp- (...values) -> Checks if value is RegExp type
- This project is licensed under MIT License