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

babel-plugin-transform-xregexp

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-xregexp - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

24

dist/index.js

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -31,2 +31,12 @@ Object.defineProperty(exports, "__esModule", {

}
},
MemberExpression: function MemberExpression(path) {
var _path$node = path.node,
object = _path$node.object,
property = _path$node.property;
if (object.type === 'RegExpLiteral' && property.name === 'source') {
path.replaceWith(t.StringLiteral(object.pattern));
}
}

@@ -37,3 +47,3 @@ }

var _xregexp = require("xregexp");
var _xregexp = require('xregexp');

@@ -49,8 +59,8 @@ var _xregexp2 = _interopRequireDefault(_xregexp);

if (!evaluatedArgs.every(function (a) {
return a.confident === true && typeof a.value === "string";
return 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 : "";
var pattern = evaluatedArgs.length >= 1 && evaluatedArgs[0].value !== '' ? evaluatedArgs[0].value : '(?:)';
var flags = evaluatedArgs.length >= 2 ? evaluatedArgs[1].value : '';

@@ -63,6 +73,6 @@ var xregexp = new _xregexp2.default(pattern, flags);

function maybeReplaceWithRegExpLiteral(path, t) {
if (!t.isIdentifier(path.node.callee, { name: "RegExp" })) {
if (!t.isIdentifier(path.node.callee, { name: 'RegExp' })) {
return;
}
var regExpLiteral = createRegExpLiteral(path.get("arguments"), t);
var regExpLiteral = createRegExpLiteral(path.get('arguments'), t);
if (regExpLiteral) {

@@ -69,0 +79,0 @@ path.replaceWith(regExpLiteral);

{
"name": "babel-plugin-transform-xregexp",
"version": "0.0.4",
"version": "0.0.5",
"description": "Use XRegExp syntax in your regular expressions",

@@ -24,2 +24,3 @@ "repository": "https://github.com/josephfrazier/babel-plugin-transform-xregexp",

"diff": "^3.2.0",
"standard": "^8.6.0",
"watch": "^1.0.1"

@@ -29,2 +30,4 @@ },

"build": "babel src --out-dir dist",
"lint": "standard",
"pretest": "npm run lint",
"test": "node test",

@@ -34,2 +37,7 @@ "watch": "node test --watch",

},
"standard": {
"ignore": [
"test/fixtures/*/*.js"
]
},
"keywords": [

@@ -36,0 +44,0 @@ "babel-plugin",

@@ -13,3 +13,5 @@ # babel-plugin-transform-xregexp

```sh
$ npm install babel-plugin-transform-xregexp
yarn add --dev babel-plugin-transform-xregexp
# or
npm install --save-dev babel-plugin-transform-xregexp
```

@@ -16,0 +18,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