used regex instead of string replacing

This commit is contained in:
sridhar-komati 2019-03-13 20:42:19 +05:30
parent 54f92514d5
commit 03d4b61208

View File

@ -40,7 +40,7 @@ export class CustomVariable implements Variable {
updateOptions() { updateOptions() {
// extract options in comma separated string (use backslash to escape wanted commas) // extract options in comma separated string (use backslash to escape wanted commas)
this.options = _.map(this.query.match(/(?:\\,|[^,])+/g), text => { this.options = _.map(this.query.match(/(?:\\,|[^,])+/g), text => {
text = text.replace('\\,', ','); text = text.replace(/\\,/g, ',');
return { text: text.trim(), value: text.trim() }; return { text: text.trim(), value: text.trim() };
}); });