Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

is-supported-regexp-flag

1.0.1 • Public • Published

is-supported-regexp-flag Build Status

Check whether a RegExp flag is supported. Mostly useful for y and u.

Install

$ npm install --save is-supported-regexp-flag

Usage

var isSupportedRegexpFlag = require('is-supported-regexp-flag');
 
isSupportedRegexpFlag('g'); // as in /foo/g
//=> true
 
isSupportedRegexpFlag('u');
//=> false

RegExp throws if you're trying to use unsupported flags. This is a nicer way to check for support.

License

MIT © Sindre Sorhus

Install

npm i is-supported-regexp-flag

DownloadsWeekly Downloads

740,890

Version

1.0.1

License

MIT

Unpacked Size

2.62 kB

Total Files

4

Last publish

Collaborators

  • avatar