TypeCheck provides a tiny collection of predictable type checking for javascript.
The goal of this library is to be a tiny dependency focused exclusively in type checking which in conjuction with ES6 provides a better experience in writting javascript code.
Requirement
This module requires support for ES6
Install
npm install js-typecheck --save
Using it
Checks if "B" is a subclass of "A"
const TypeCheck = {} {} TypeCheck
Checks if the input objects are the same type
TypeCheck
Returns if the input is an object
TypeCheck
Checks if the input is a plain object (objects created using literal notation):
TypeCheck
Checks if the input is an array object
TypeCheck
Checks if the input is none, either null or undefined
TypeCheck
or
TypeCheck
Checks if the input is a function
TypeCheck
or
TypeCheck
Checks if the input is a string type
TypeCheck
Checks if the input is a number type
TypeCheck
Checks if the input is a boolean type
TypeCheck
Checks if value is a primitive
TypeCheck // trueTypeCheck // trueTypeCheck // trueTypeCheck // trueTypeCheck // trueTypeCheck // false
Examples
Take a look at the tests for more examples about it
Licensing
js-typecheck is free software; you can redistribute it and/or modify it under the terms of the MIT License