From f8e5cbd81ae8966980cd8546718902d0ab8d705d Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 5 Jun 2017 14:33:52 +0200 Subject: [PATCH] prefer const when not reasigned --- app/assets/javascripts/discourse/components/d-editor.js.es6 | 4 ++-- app/assets/javascripts/pretty-text/emoji.js.es6 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index d9431532d48..5fd79893a00 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -338,7 +338,7 @@ export default Ember.Component.extend({ }, onKeyUp(text, cp) { - var subtext = text.substring(0, cp); + const subtext = text.substring(0, cp); return subtext.match(/(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gm); }, @@ -377,7 +377,7 @@ export default Ember.Component.extend({ return resolve([translations[full]]); } - let match = term.match(/^:?(.*?):t(\d)?$/); + const match = term.match(/^:?(.*?):t(\d)?$/); if (match) { let name = match[1]; let scale = match[2]; diff --git a/app/assets/javascripts/pretty-text/emoji.js.es6 b/app/assets/javascripts/pretty-text/emoji.js.es6 index 5b179a65aef..1675e6e5e20 100644 --- a/app/assets/javascripts/pretty-text/emoji.js.es6 +++ b/app/assets/javascripts/pretty-text/emoji.js.es6 @@ -64,7 +64,7 @@ export function buildEmojiUrl(code, opts) { url = opts.customEmoji[code]; } - let noToneMatch = code.match(/(.?[\w-]*)?:?/); + const noToneMatch = code.match(/(.?[\w-]*)?:?/); if (noToneMatch && !url && (emojiHash.hasOwnProperty(noToneMatch[1]) || aliasHash.hasOwnProperty(noToneMatch[1]))) { url = opts.getURL(`/images/emoji/${opts.emojiSet}/${code.replace(/:t/, '/')}.png`); }