From 00541ba898c1a42b0a758b20be378846ef5c08ac Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Tue, 13 Jan 2015 10:29:34 -0700 Subject: [PATCH] Speed E the fuck up Conflicts: builds/appchan-x.user.js builds/crx/script.js src/General/Globals.coffee --- src/General/Globals.coffee | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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