Constructor
new Type()
- Source:
Methods
(static) is(val, expected) → {boolean}
- Description:
- Checks if a value matches an expected type (by string constant, Constructor, or union array).
- Source:
Parameters:
| Name |
Type |
Description |
val |
*
|
Value to check. |
expected |
string
|
function
|
Array.<(string|function())>
|
Expected type, constructor, or union array. |
Returns:
-
Type
-
boolean
(static) of(val) → {string}
- Description:
- Returns the canonical runtime type of any value as a lowercase string.
Differentiates NaN ('nan') from valid numbers ('number'), distinguishes 'array', 'null', 'date', etc.
- Source:
Parameters:
| Name |
Type |
Description |
val |
*
|
Value to check. |
Returns:
The canonical type string.
-
Type
-
string
(static) same(a, b) → {boolean}
- Description:
- Compares whether two values have the exact same canonical type.
Safely prevents JavaScript traps like typeof NaN === typeof 42 or typeof null === typeof {}.
- Source:
Parameters:
| Name |
Type |
Description |
a |
*
|
First value. |
b |
*
|
Second value. |
Returns:
True if both values share the same type.
-
Type
-
boolean