• Returns a regex pattern that escaped the given pattern

    Parameters

    • Optionalpattern: string

      the pattern to inspect

    Returns string | undefined

    a regex pattern that escaped the given pattern

    escapePattern('\\');    // '\\\\'
    escapePattern('-+='); // '\\-\\+='