From c75d04ccb771d369f92b5399e00533ae69dd4c44 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 24 Jan 2020 21:51:58 -0500 Subject: Change uniqueDeinflectionsMap to use a real Map --- ext/bg/js/translator.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'ext/bg') diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 0f89111f..8a58e224 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -290,17 +290,15 @@ class Translator { const uniqueDeinflectionTerms = []; const uniqueDeinflectionArrays = []; - const uniqueDeinflectionsMap = {}; + const uniqueDeinflectionsMap = new Map(); for (const deinflection of deinflections) { const term = deinflection.term; - let deinflectionArray; - if (hasOwn(uniqueDeinflectionsMap, term)) { - deinflectionArray = uniqueDeinflectionsMap[term]; - } else { + let deinflectionArray = uniqueDeinflectionsMap.get(term); + if (typeof deinflectionArray === 'undefined') { deinflectionArray = []; uniqueDeinflectionTerms.push(term); uniqueDeinflectionArrays.push(deinflectionArray); - uniqueDeinflectionsMap[term] = deinflectionArray; + uniqueDeinflectionsMap.set(term, deinflectionArray); } deinflectionArray.push(deinflection); } -- cgit v1.2.3