Releases: KooiInc/typeofAnything
Releases · KooiInc/typeofAnything
v2.4
v2.3
v2.2
Notes for this version
- A number of ES20xx Objects contain the 'well known Symbol'
Symbol.toStringTagin their prototype. Such objects use that Symbol for their string representation (toString).
Such 'types' are not always available as known constructors in the (global) namespace (like for exampleHTMLElementor
RegExpare), so one can't always use (for example)IS(new Float32Array(1), Float32Array)). - For the
Proxytype check, the globalwindow`namespace disables the library for use in NodeJS.
Added/modified
- When
toStringTagis availableIS(input)or[type]reports that as the 'type' of the input between square brackets (e.g.[object Array Iterator]). - One can check non-available global constructors using their string representation, e.g.
IS(new Float32Array(1), "Float32Array") windowis removed from the rewrittenProxy, which enables its use in NodeJS.
See also MDN documentation
v2.1
v2.0
Based on usage experiences and progressive insight, this library has been overhauled and simplified. The basic functionality (IS) is the same, with some addititions. Some exports are removed because they became obsolete.
The library use
Added functionality:
- functionality for type checks except one or more type(s)
- functionality to return a default value if checking input type(s) is unsuccessful
- functionality to enable/disable reporting Proxy 'type' (enabled by default)
Added exports
xProxy: an Object to disable/enable reporting the Proxy 'type'.
Removed exports
is/type. After importing thetypeofAnythingmodule the symbols exist by default asSymbol.isandSymbol.type.
This means that variables can be type checked with[some variable][Symbol.is](...types)[some variable][Symbol.type]
createWrappedProxy(obsolete)extendObject(obsolete, is now default)typeOf(adds nothing to existing functionality)
Renamed exports
$Xis now named$Wrap
See the (updated) examples.