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-2022. The Stdlib Authors.
0.0.8 (2022-02-16)
No changes reported for this release.
</section>
<!-- /.release -->
<section class="release" id="v0.0.7">