From bea1b0101ae64696842c0d4fff1b3abfcc52bd07 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Sun, 9 Nov 2014 22:49:46 -0500 Subject: [PATCH] Constantize regexes --- assets/javascripts/models/entry.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/models/entry.coffee b/assets/javascripts/models/entry.coffee index 1a529181..db4fabce 100644 --- a/assets/javascripts/models/entry.coffee +++ b/assets/javascripts/models/entry.coffee @@ -3,6 +3,8 @@ class app.models.Entry extends app.Model SEPARATORS_REGEXP = /\:?\ |#|::|->/g PARANTHESES_REGEXP = /\(.*?\)$/ + EVENT_REGEXP = /\ event$/ + DOT_REGEXP = /\.+/g constructor: -> super @@ -12,9 +14,9 @@ class app.models.Entry extends app.Model @name .toLowerCase() .replace '...', ' ' - .replace /\ event$/, '' + .replace EVENT_REGEXP, '' .replace SEPARATORS_REGEXP, '.' - .replace /\.+/g, '.' + .replace DOT_REGEXP, '.' .replace PARANTHESES_REGEXP, '' .trim()