Hi, I’ve made a runtime “type” checker named Tycker. Its purpose is to have a wide definition of what is a type, and make it as easy as possible to check if a variable is of given “type“. This would allow to check easily if a function’s arguments are as the have to or to easily execute different code depending on the type (as if you have done something like switch(type(my_variable)).If you want an example of code, see the repro’s readme, and if you want a list of its functionalities, see the wiki/API.

In case you wonder what I call a type in Tycker, it is actually a function that says whether a variable is of the given type or not. There is a predefined type for each primitive and each built-in class (plus some types I found useful as 'all' or 'null'), and you can define a type as you wish.

Tycker is still on a early development stage, and I was wondering if it would be useful for anyone but myself. As you can see on the repro, I’ve given no license and I’ve not written the definition of a Tycker’s type in the API. Time is a bit precious to me, and if no one wants to use Tycker, I’ll just let it as is and use it myself, edit it when I need to and use it to show I know how to make a project. But if someone would need it, just ask me !

r/webdev - My JS runtime "type" checker - tell me if it's useful

The logo

Source link

Write A Comment