remove redundant regex
This commit is contained in:
parent
fc1941e2bc
commit
330faf85e0
@ -62,19 +62,6 @@
|
|||||||
// seconds counter
|
// seconds counter
|
||||||
var totalSeconds = 0;
|
var totalSeconds = 0;
|
||||||
|
|
||||||
// dynamically generate units regular expression
|
|
||||||
var unitsRegExp = '';
|
|
||||||
|
|
||||||
for(var unit in this.units) {
|
|
||||||
unitsRegExp += ',' + this.units[unit].join();
|
|
||||||
}
|
|
||||||
|
|
||||||
unitsRegExp = '(' +
|
|
||||||
unitsRegExp
|
|
||||||
.replace(/,/g, '|') // convert commas to pipes
|
|
||||||
.replace('|', '') // removing leading pipe
|
|
||||||
+ ')';
|
|
||||||
|
|
||||||
// split string into groups and get total seconds for each group
|
// split string into groups and get total seconds for each group
|
||||||
var groups = string
|
var groups = string
|
||||||
.replace(/[^\w+-]+/g, '') // remove white space
|
.replace(/[^\w+-]+/g, '') // remove white space
|
||||||
|
Loading…
Reference in New Issue
Block a user