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

View File

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

View File

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