Function isRegExp

  • Checks if value is a RegExp.

    Parameters

    • value: unknown

      The value to check.

    Returns value is RegExp

    Returns true if value is a RegExp, false otherwise.

    const value1 = /abc/;
    const value2 = '/abc/';

    console.log(isRegExp(value1)); // true
    console.log(isRegExp(value2)); // false