is-supported-regexp-flag

2.0.0 • Public • Published

is-supported-regexp-flag

Check whether a RegExp flag is supported

Install

$ npm install is-supported-regexp-flag

Usage

import isSupportedRegexpFlag from '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.

Package Sidebar

Install

npm i is-supported-regexp-flag

Weekly Downloads

485,373

Version

2.0.0

License

MIT

Unpacked Size

2.35 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus