diff --git a/src/General/Globals.coffee b/src/General/Globals.coffee index 2f6033615..ad31a194a 100755 --- a/src/General/Globals.coffee +++ b/src/General/Globals.coffee @@ -9,6 +9,11 @@ g = FAQ: '<%= meta.faq %>' CHANGELOG: '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' boards: {} -E = (text) -> - (text+'').replace /[&"'<>]/g, (x) -> - {'&': '&', "'": ''', '"': '"', '<': '<', '>': '>'}[x] + +E = do -> + str = {'&': '&', "'": ''', '"': '"', '<': '<', '>': '>'} + r = String::replace + regex = /[&"'<>]/g + fn = (x) -> + str[x] + (text) -> r.call text, regex, fn