Value | typeiss.js |
---|---|
Undeclared variables | Undefined |
undefined | Undefined |
Boolean | Boolean |
Number | Number |
String | String |
Function | Function |
Array | Array |
Object | Object |
Date | Date |
RegExp | RegExp |
Set | Set |
Map | Map |
npm install typeiss
import { typeiss } from 'typeiss'
const a = require('typeiss')
<script src="typeis.js"></script>
// return variable type
typeiss(undefined) //return Undefined
typeiss(true) //return Boolean
typeiss('string') //return String
···
// return the variable type is or not in an array
typeiss(undefined, ['Undefined']) //return true
typeiss(true, ['Boolean','Array']) //return true
typeiss(true, ['Array']) //return false
typeiss('string', ['String','Boolean','Array']) //return true
typeiss('string', ['Boolean','Array']) //return false