diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-01-24 21:51:58 -0500 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-01-24 21:51:58 -0500 | 
| commit | c75d04ccb771d369f92b5399e00533ae69dd4c44 (patch) | |
| tree | fef87967d61f536607befaa1a4bbbade8c6d6a09 | |
| parent | 7357eaf07a899a20de715026de7e4baaa37d4539 (diff) | |
Change uniqueDeinflectionsMap to use a real Map
| -rw-r--r-- | ext/bg/js/translator.js | 10 | 
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);          } |