If you accept the ideas above, this would become:

```js
return new RegExp(pattern, modifiers).test(value);
```