| 2138 | if (!pattern) { | 2138 | if (!pattern) { |
| 2139 | throw new Error('Argument of \'pattern=\' cannot be empty'); | 2139 | throw new Error('Argument of \'pattern=\' cannot be empty'); |
| 2140 | } | 2140 | } |
| 2141 | let re = regexFromString(pattern.toString()); | 2141 | const re = regexFromString(pattern.toString()); |
| 2142 | if (!re) { | 2142 | if (!re) { |
| 2143 | throw new Error('The value of \'pattern\' argument is not a valid regular expression.'); | 2143 | throw new Error('The value of \'pattern\' argument is not a valid regular expression.'); |
| 2144 | } | 2144 | } |