Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "assert/is-syntax-error/docs/types/index.d"

Index

Functions

Functions

Export assignment isSyntaxError

  • isSyntaxError(value: any): boolean
  • Tests if a value is a SyntaxError object.

    Notes

    • This function should not be considered robust. While the function should always return true if provided a SyntaxError (or a descendant) object, false positives may occur due to the fact that the SyntaxError constructor inherits from Error and has no internal class of its own. Hence, SyntaxError impersonation is possible.

    Parameters

    • value: any

      value to test

    Returns boolean

    boolean indicating whether a value is a SyntaxError object

    Example

    var bool = isSyntaxError( new SyntaxError( 'beep' ) );
    // returns true

    Example

    var bool = isSyntaxError( {} );
    // returns false