isError
Test if a value is an Error object.
Installation
npm install @stdlib/assert-is-error
Usage
var isError = require( '@stdlib/assert-is-error' );
isError( value )
Tests if a value
is an Error
object.
var bool = isError( new Error( 'beep' ) );
Examples
var isError = require( '@stdlib/assert-is-error' );
var bool = isError( new Error( 'error' ) );
bool = isError( new EvalError( 'eval error' ) );
bool = isError( new RangeError( 'range error' ) );
bool = isError( new ReferenceError( 'reference error' ) );
bool = isError( new SyntaxError( 'syntax error' ) );
bool = isError( new TypeError( 'type error' ) );
bool = isError( new URIError( 'URI error' ) );
bool = isError( {} );
bool = isError( null );
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
License
See LICENSE.
Copyright
Copyright © 2016-2021. The Stdlib Authors.
0.0.6 (2021-07-09)
No changes reported for this release.
</section>
<!-- /.release -->
<section class="release" id="v0.0.5">