Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-supported-regexp-flag

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-supported-regexp-flag - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

16

index.js

@@ -1,12 +0,8 @@

'use strict';
module.exports = function (flag) {
var supported = true;
export default function isSupportedRegexpFlag(flag) {
try {
new RegExp('', flag);
} catch (err) {
supported = false;
new RegExp('', flag); // eslint-disable-line no-new
return true;
} catch {
return false;
}
return supported;
};
}
{
"name": "is-supported-regexp-flag",
"version": "1.0.1",
"description": "Check whether a RegExp flag is supported. Mostly useful for `y` and `u`.",
"license": "MIT",
"repository": "sindresorhus/is-supported-regexp-flag",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"keywords": [
"regexp",
"regex",
"re",
"check",
"is",
"support",
"supported",
"valid",
"flag"
],
"devDependencies": {
"mocha": "*"
}
"name": "is-supported-regexp-flag",
"version": "2.0.0",
"description": "Check whether a RegExp flag is supported",
"license": "MIT",
"repository": "sindresorhus/is-supported-regexp-flag",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12.20"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"regexp",
"regex",
"check",
"is",
"support",
"supported",
"valid",
"flag"
],
"devDependencies": {
"ava": "^3.15.0",
"xo": "^0.42.0"
}
}

@@ -1,19 +0,17 @@

# is-supported-regexp-flag [![Build Status](https://travis-ci.org/sindresorhus/is-supported-regexp-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/is-supported-regexp-flag)
# is-supported-regexp-flag
> Check whether a RegExp flag is supported. Mostly useful for `y` and `u`.
> Check whether a RegExp flag is supported
## Install
```sh
$ npm install --save is-supported-regexp-flag
```
$ npm install is-supported-regexp-flag
```
## Usage
```js
var isSupportedRegexpFlag = require('is-supported-regexp-flag');
import isSupportedRegexpFlag from 'is-supported-regexp-flag';
isSupportedRegexpFlag('g'); // as in /foo/g
isSupportedRegexpFlag('g'); // As in `/foo/g`
//=> true

@@ -25,7 +23,2 @@

RegExp throws if you're trying to use unsupported flags. This is a nicer way to check for support.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
The `RegExp` constructor throws if you're trying to use unsupported flags. This is a nicer way to check for support.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc