wix-style-processor
Advanced tools
Comparing version 3.1.3 to 3.1.4
@@ -17,2 +17,4 @@ export declare class Plugins { | ||
private updateRegex; | ||
private extractParams; | ||
private isLegalExpression; | ||
} |
@@ -26,3 +26,3 @@ var paramsRegex = /,(?![^(]*(?:\)|}))/g; | ||
funcName: groups[1], | ||
args: groups[2].split(paramsRegex) | ||
args: this.extractParams(groups[2]) | ||
}; | ||
@@ -35,2 +35,18 @@ } | ||
}; | ||
Plugins.prototype.extractParams = function (params) { | ||
var _this = this; | ||
var result = []; | ||
var args = params.split(paramsRegex); | ||
args.reduce(function (acc, arg) { | ||
if (_this.isLegalExpression(acc + arg)) { | ||
result.push(acc ? acc + "," + arg : arg); | ||
return ''; | ||
} | ||
return acc ? acc + "," + arg : arg; | ||
}, ''); | ||
return result; | ||
}; | ||
Plugins.prototype.isLegalExpression = function (expression) { | ||
return expression.split(/\(/g).length === expression.split(/\)/g).length; | ||
}; | ||
return Plugins; | ||
@@ -37,0 +53,0 @@ }()); |
@@ -17,2 +17,4 @@ export declare class Plugins { | ||
private updateRegex; | ||
private extractParams; | ||
private isLegalExpression; | ||
} |
@@ -28,3 +28,3 @@ "use strict"; | ||
funcName: groups[1], | ||
args: groups[2].split(paramsRegex) | ||
args: this.extractParams(groups[2]) | ||
}; | ||
@@ -37,2 +37,18 @@ } | ||
}; | ||
Plugins.prototype.extractParams = function (params) { | ||
var _this = this; | ||
var result = []; | ||
var args = params.split(paramsRegex); | ||
args.reduce(function (acc, arg) { | ||
if (_this.isLegalExpression(acc + arg)) { | ||
result.push(acc ? acc + "," + arg : arg); | ||
return ''; | ||
} | ||
return acc ? acc + "," + arg : arg; | ||
}, ''); | ||
return result; | ||
}; | ||
Plugins.prototype.isLegalExpression = function (expression) { | ||
return expression.split(/\(/g).length === expression.split(/\)/g).length; | ||
}; | ||
return Plugins; | ||
@@ -39,0 +55,0 @@ }()); |
@@ -5,3 +5,3 @@ { | ||
"description": "An alternative Wix Styles TPA processor", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"author": { | ||
@@ -8,0 +8,0 @@ "name": "Eran Shabi", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
420525
6594