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

babel-plugin-transform-regexp-constructors

Package Overview
Dependencies
Maintainers
5
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-regexp-constructors - npm Package Compare versions

Comparing version 0.5.0-alpha.55276695 to 0.5.0-alpha.18dcfe13

19

lib/index.js
"use strict";
function createRegExpLiteral(args, prettify, t) {
var evaluatedArgs = args.map(function (a) {
return a.evaluate();
});
const evaluatedArgs = args.map(a => a.evaluate());
if (!evaluatedArgs.every(function (a) {
return a.confident && typeof a.value === "string";
})) {
if (!evaluatedArgs.every(a => a.confident && typeof a.value === "string")) {
return;
}
var pattern = evaluatedArgs.length >= 1 && evaluatedArgs[0].value !== "" ? evaluatedArgs[0].value : "(?:)";
var flags = evaluatedArgs.length >= 2 ? evaluatedArgs[1].value : "";
let pattern = evaluatedArgs.length >= 1 && evaluatedArgs[0].value !== "" ? evaluatedArgs[0].value : "(?:)";
const flags = evaluatedArgs.length >= 2 ? evaluatedArgs[1].value : "";
pattern = new RegExp(pattern).source;

@@ -33,3 +29,3 @@

var regExpLiteral = createRegExpLiteral(path.get("arguments"), true, t);
const regExpLiteral = createRegExpLiteral(path.get("arguments"), true, t);

@@ -41,4 +37,5 @@ if (regExpLiteral) {

module.exports = function (_ref) {
var t = _ref.types;
module.exports = function ({
types: t
}) {
return {

@@ -45,0 +42,0 @@ name: "transform-regexp-constructors",

{
"name": "babel-plugin-transform-regexp-constructors",
"version": "0.5.0-alpha.55276695",
"version": "0.5.0-alpha.18dcfe13",
"description": "This changes RegExp constructors into literals if the RegExp arguments are strings.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -24,3 +24,3 @@ # babel-plugin-transform-regexp-constructors

```sh
npm install babel-plugin-transform-regexp-constructors
npm install babel-plugin-transform-regexp-constructors --save-dev
```

@@ -27,0 +27,0 @@

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