Value Check Standardisation Proposal

I ran into this for almost every project and started to wonder why this is not a standard in JS.
So I started to write down a possible solution as an unofficial proposal.

What are your thoughts on this?

Personally, I find typeof intuitive and instanceof is unreliable and I suggest never using it.

For language primitives, you may find interesting - in addition, if you want correct and robust userland implementations, all the "is-" packages in may be useful.

1 Like

Yeah, thats what I am describing is that we basically have to rely on 3rd party libs when JS has some but not consistent support. The goal of this is to have builtin methods to check. These suggested methods are an extension on what JS already has implemented.

The istypes proposal looks interesting, however It seems to be inactive since 2018.

The proposal also could be extended for other classes like inspect-js does (example: RegExp.isRegExp()) and still be consistent.