regexp-tree
Advanced tools
Comparing version 0.1.16 to 0.1.17
@@ -31,6 +31,14 @@ /** | ||
optimize: function optimize(regexp) { | ||
var transformsWhitelist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
_ref$whitelist = _ref.whitelist, | ||
whitelist = _ref$whitelist === undefined ? [] : _ref$whitelist, | ||
_ref$blacklist = _ref.blacklist, | ||
blacklist = _ref$blacklist === undefined ? [] : _ref$blacklist; | ||
var transformToApply = transformsWhitelist.length > 0 ? transformsWhitelist : Object.keys(optimizationTransforms); | ||
var transformsRaw = whitelist.length > 0 ? whitelist : Object.keys(optimizationTransforms); | ||
var transformToApply = transformsRaw.filter(function (transform) { | ||
return !blacklist.includes(transform); | ||
}); | ||
var ast = regexp; | ||
@@ -37,0 +45,0 @@ if (regexp instanceof RegExp) { |
@@ -75,5 +75,5 @@ /** | ||
* }); | ||
* | ||
* The value for a node type may also be an object with functions pre and post. | ||
* This enables more context-aware analyses, e.g. measuring star height. | ||
* | ||
* The value for a node type may also be an object with functions pre and post. | ||
* This enables more context-aware analyses, e.g. measuring star height. | ||
*/ | ||
@@ -136,3 +136,6 @@ traverse: function traverse(ast, handlers, options) { | ||
optimize: function optimize(regexp, whitelist) { | ||
return optimizer.optimize(regexp, whitelist); | ||
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
blacklist = _ref.blacklist; | ||
return optimizer.optimize(regexp, { whitelist: whitelist, blacklist: blacklist }); | ||
}, | ||
@@ -139,0 +142,0 @@ |
{ | ||
"name": "regexp-tree", | ||
"version": "0.1.16", | ||
"version": "0.1.17", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Regular Expressions parser in JavaScript", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
312065
6430