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.3.0-alpha.7f4dc3d4 to 0.3.0-alpha.879f25ec

18

lib/index.js
"use strict";
function createRegExpLiteral(args, prettify, t) {
var evaluatedArgs = args.map(function (a) {
return a.evaluate();
});
if (!evaluatedArgs.every(function (a) {
return a.confident && typeof a.value === "string";
})) {
const evaluatedArgs = args.map(a => a.evaluate());
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 : "";

@@ -29,3 +25,3 @@ pattern = new RegExp(pattern).source;

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

@@ -36,5 +32,3 @@ path.replaceWith(regExpLiteral);

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

@@ -41,0 +35,0 @@ name: "transform-regexp-constructors",

{
"name": "babel-plugin-transform-regexp-constructors",
"version": "0.3.0-alpha.7f4dc3d4",
"version": "0.3.0-alpha.879f25ec",
"description": "This changes RegExp constructors into literals if the RegExp arguments are strings.",

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

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