|
||
---|---|---|
.. | ||
docs | ||
lib | ||
package.json | ||
README.md |
isEvalError
Test if a value is an EvalError object.
Usage
var isEvalError = require( '@stdlib/assert/is-eval-error' );
isEvalError( value )
Tests if a value
is an EvalError
object.
var bool = isEvalError( new EvalError( 'beep' ) );
// returns true
Notes
- This function should not be considered robust. While the function should always return
true
if provided anEvalError
(or a descendant) object, false positives may occur due to the fact that theEvalError
constructor inherits fromError
and has no internal class of its own. Hence,EvalError
impersonation is possible.
Examples
var isEvalError = require( '@stdlib/assert/is-eval-error' );
var bool = isEvalError( new EvalError( 'eval error' ) );
// returns true
bool = isEvalError( new Error( 'error' ) );
// returns false
bool = isEvalError( new RangeError( 'range error' ) );
// returns false
bool = isEvalError( new ReferenceError( 'reference error' ) );
// returns false
bool = isEvalError( new SyntaxError( 'syntax error' ) );
// returns false
bool = isEvalError( new TypeError( 'type error' ) );
// returns false
bool = isEvalError( new URIError( 'URI error' ) );
// returns false
bool = isEvalError( {} );
// returns false
bool = isEvalError( null );
// returns false