is-supported-regexp-flag ![Build Status](https://camo.githubusercontent.com/fcd3fc5b82a5dbbc63668f20584b3d486ee8350f1feee1fa43c132f8bdb114ff/68747470733a2f2f7472617669732d63692e6f72672f73696e647265736f726875732f69732d737570706f727465642d7265676578702d666c61672e7376673f6272616e63683d6d6173746572)
Check whether a RegExp flag is supported. Mostly useful for
y
andu
.
Install
$ npm install is-supported-regexp-flag
Usage
const isSupportedRegexpFlag = require('is-supported-regexp-flag');
isSupportedRegexpFlag('g'); // As in `/foo/g`
//=> true
isSupportedRegexpFlag('u');
//=> false
The RegExp
constructor throws if you're trying to use unsupported flags. This is a nicer way to check for support.
License
MIT © Sindre Sorhus