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