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

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 an EvalError (or a descendant) object, false positives may occur due to the fact that the EvalError constructor inherits from Error 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