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
trueif provided anEvalError(or a descendant) object, false positives may occur due to the fact that theEvalErrorconstructor inherits fromErrorand has no internal class of its own. Hence,EvalErrorimpersonation 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
See Also
@stdlib/assert/is-error: test if a value is an Error object.