Detect whether a value is an error.
Determine whether or not a given value
is an Error
type.
Kind: Exported function
Returns: boolean
- Returns true
if value
is an Error
type,
else false
.
Param | Type | Description |
---|---|---|
value | * |
The object to be tested. |
Example
import isError from 'is-error-x';
console.log(isError()); // false
console.log(isError(Number.MIN_VALUE)); // false
console.log(isError('abc')); // false
console.log(isError(new Error())); //true