Safe (chainable) type checks
Currently supported are:
The checkt library exposes the checkt function. (An alias is the check object, which has exactly the same functionality.)
js/checkt.js in your HTML file for development purposes and
js/checkt.min.js for production use.
Either use npm with
npm install checkt
checkt to to the package.json of your project.
// Method chaining examplesnot;// Instead of using method chaing, you can also use// a plain object with the type as the key and the value is the callback function;// Multiple keys seperated by a comma also work, just make sure the key is// written as a string;
# Method chaining examplescheck'test'notstring-> consolelog 'not a string'else-> consolelog 'Logically, should be a string'number consolelog"its a number with value: "# Instead of using method chaing, you can also use# a plain object with the type as the key and the value is the callback functioncheck: -> consolelog 'Is an object': -> consolelog 'Is a number'# Multiple keys seperated by a comma also work, just make sure the key is# written as a stringcheck 'test''string, number': -> consolelog 'Either string or number'
checkt is public domain. See UNLICENSE.md for more information.