Speed E the fuck up

This commit is contained in:
Zixaphir 2015-01-13 10:29:34 -07:00
parent ba380613ed
commit 7e6720ee4d
3 changed files with 43 additions and 25 deletions

View File

@ -508,17 +508,24 @@
boards: {} boards: {}
}; };
E = function(text) { E = (function() {
return (text + '').replace(/[&"'<>]/g, function(x) { var fn, r, regex, str;
return { str = {
'&': '&amp;', '&': '&amp;',
"'": '&#039;', "'": '&#039;',
'"': '&quot;', '"': '&quot;',
'<': '&lt;', '<': '&lt;',
'>': '&gt;' '>': '&gt;'
}[x]; };
}); r = String.prototype.replace;
}; regex = /[&"'<>]/g;
fn = function(x) {
return str[x];
};
return function(text) {
return r.call(text, regex, fn);
};
})();
Mascots = { Mascots = {
'Akiyama_Mio': { 'Akiyama_Mio': {

View File

@ -480,17 +480,24 @@
boards: {} boards: {}
}; };
E = function(text) { E = (function() {
return (text + '').replace(/[&"'<>]/g, function(x) { var fn, r, regex, str;
return { str = {
'&': '&amp;', '&': '&amp;',
"'": '&#039;', "'": '&#039;',
'"': '&quot;', '"': '&quot;',
'<': '&lt;', '<': '&lt;',
'>': '&gt;' '>': '&gt;'
}[x]; };
}); r = String.prototype.replace;
}; regex = /[&"'<>]/g;
fn = function(x) {
return str[x];
};
return function(text) {
return r.call(text, regex, fn);
};
})();
Mascots = { Mascots = {
'Akiyama_Mio': { 'Akiyama_Mio': {

View File

@ -14,6 +14,10 @@ g =
CHANGELOG: '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' CHANGELOG: '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md'
boards: {} boards: {}
E = (text) -> E = do ->
(text+'').replace /[&"'<>]/g, (x) -> str = {'&': '&amp;', "'": '&#039;', '"': '&quot;', '<': '&lt;', '>': '&gt;'}
{'&': '&amp;', "'": '&#039;', '"': '&quot;', '<': '&lt;', '>': '&gt;'}[x] r = String::replace
regex = /[&"'<>]/g
fn = (x) ->
str[x]
(text) -> r.call text, regex, fn