objectToString
function objectToString(value: unknown): string;
Object.prototype.toString.call(value), in a form that is safe to call on anything, including null and undefined. Several guards in this library are built on it, because the tag survives crossing a frame boundary where instanceof does not.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The value to tag. |
Returns
string — the tag, such as "[object Array]".
Examples
Reading the tag
objectToString([]); // => "[object Array]"
objectToString(null); // => "[object Null]"
objectToString(new Date()); // => "[object Date]"
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.