This commit is contained in:
toasted-nutbread 2020-02-15 12:27:18 -05:00
parent f3c4b0e1e1
commit 452eec8a88

View File

@ -491,15 +491,18 @@ function dictionaryErrorsShow(errors) {
dialog.textContent = ''; dialog.textContent = '';
if (errors !== null && errors.length > 0) { if (errors !== null && errors.length > 0) {
const uniqueErrors = {}; const uniqueErrors = new Map();
for (let e of errors) { for (let e of errors) {
console.error(e); console.error(e);
e = dictionaryErrorToString(e); e = dictionaryErrorToString(e);
uniqueErrors[e] = hasOwn(uniqueErrors, e) ? uniqueErrors[e] + 1 : 1; let count = uniqueErrors.get(e);
if (typeof count === 'undefined') {
count = 0;
}
uniqueErrors.set(e, count + 1);
} }
for (const e in uniqueErrors) { for (const [e, count] of uniqueErrors.entries()) {
const count = uniqueErrors[e];
const div = document.createElement('p'); const div = document.createElement('p');
if (count > 1) { if (count > 1) {
div.textContent = `${e} `; div.textContent = `${e} `;