Replacing replace's options to flags

This commit is contained in:
Jake Bellacera
2014-02-06 23:41:18 -08:00
parent 089bf1b78a
commit 98f48bcb78
3 changed files with 4 additions and 4 deletions

View File

@@ -218,10 +218,10 @@ tree.functions = {
escape: function (str) {
return new(tree.Anonymous)(encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B").replace(/\(/g, "%28").replace(/\)/g, "%29"));
},
replace: function (subject, pattern, replacement, options) {
replace: function (subject, pattern, replacement, flags) {
var str = subject.value;
str = str.replace(new RegExp(pattern.value, options ? options.value : ""), replacement.value);
str = str.replace(new RegExp(pattern.value, flags ? flags.value : ""), replacement.value);
return new(tree.Quoted)('"' + str + '"', str);
},