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.5ee3078e to 0.3.0-alpha.636ae276

18

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

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

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

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

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

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

{
"name": "babel-plugin-transform-regexp-constructors",
"version": "0.3.0-alpha.5ee3078e",
"version": "0.3.0-alpha.636ae276",
"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