2.1.0
The old usage is still there (Typpy([]) === "array"
) but now Typpy
is a little bit smarter: if we pass a second argument, Typpy
returns a Boolean
value:
Typpy("Hello World", String); // => true
Typpy(42, "number"); // => true
Internally it uses the following new functions:
Typpy.is
: checks if the input has the same type with a provided type (constructor or string)Typpy.get
: gets the input value type and returns the constructor or the string
Bonus, starting with this release, NaN
is handled too. It's not considered a number but a NaN
(not a number). ✨