Skip to content

isEvalError

The isEvalError function checks if a value is an instance of EvalError.

Syntax

typescript
isEvalError(value: any): value is EvalError;

Parameters

NameTypeDescription
valueanyThe value to check

Returns

TypeDescription
booleantrue if the value is an instance of EvalError, false otherwise

Examples

typescript
isEvalError(new EvalError("Evaluation error"));
// => true

isEvalError(new Error());
// => false

isEvalError({});
// => false

Notes

  • Useful for identifying errors related to the use of the eval function.

References

Released under the MIT License.