summaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-24 21:51:58 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-24 21:51:58 -0500
commitc75d04ccb771d369f92b5399e00533ae69dd4c44 (patch)
treefef87967d61f536607befaa1a4bbbade8c6d6a09 /ext/bg/js/translator.js
parent7357eaf07a899a20de715026de7e4baaa37d4539 (diff)
Change uniqueDeinflectionsMap to use a real Map
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js10
1 files changed, 4 insertions, 6 deletions
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);
}