time-to-botec/squiggle/node_modules/@stdlib/assert/is-error/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

2.7 KiB

isError

Test if a value is an Error object.

Usage

var isError = require( '@stdlib/assert/is-error' );

isError( value )

Tests if a value is an Error object.

var bool = isError( new Error( 'beep' ) );
// returns true

Examples

var isError = require( '@stdlib/assert/is-error' );

var bool = isError( new Error( 'error' ) );
// returns true

bool = isError( new EvalError( 'eval error' ) );
// returns true

bool = isError( new RangeError( 'range error' ) );
// returns true

bool = isError( new ReferenceError( 'reference error' ) );
// returns true

bool = isError( new SyntaxError( 'syntax error' ) );
// returns true

bool = isError( new TypeError( 'type error' ) );
// returns true

bool = isError( new URIError( 'URI error' ) );
// returns true

bool = isError( {} );
// returns false

bool = isError( null );
// returns false