instanceOfGuard()
ts
function instanceOfGuard<T>(constructor): Guard<T>Returns a guard that checks whether the data is an instance of the given constructor.
Example
ts
const isError = instanceOfGuard(Error)
isError(new Error()) // -> trueType Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
constructor | (...args) => T | the right-hand side argument of the instanceof operator |
Returns
Guard<T>
