Function isRegExp

  • Checks if a given value is a valid RegExp object.

    Example

    isRegExp(/ab+c/)
    // => true

    isRegExp(new RegExp("ab+c", "i"))
    // => true

    isRegExp('/test/')
    // => false

    isRegExp(10)
    // => false

    Type Parameters

    • T extends RegExp<T> = RegExp

      The type of the input value.

    Parameters

    • value: unknown

      The value to be checked.

    Returns value is T

    true if the given value is a RegExp object, false otherwise.

Generated using TypeDoc v0.24.7