A list of bool functions that checks for type of a JS variable .
This uses the strict equality operator (===) while checking.
npm i check-fn --save
Add this line at your top of the javascript file and import any function you want.
import {
checkNum,
checkBigInt,
checkStr,
checkBool,
checkSym,
checkUnd,
checkObj,
checkFn
} from 'check-fn';
Make use of the following functions in your code.
checkNum(42);
// true
checkBigInt(42n);
// true
checkStr("foo");
// true
checkBool(true);
// true
checkSym(Symbol());
// true
let bar;
checkUnd(bar);
// true
checkObj({"rainbow": "🌈"});
// true
const bazz = () => { console.log("🦄") }
checkFn(bazz);
// true
Congratulations You Can make your Code even shorter than before.
MIT License