function dedupeErrors() {
      entries(errors).forEach((entry) => {
        const i = entry[0];
        const error = entry[1];

        const index = error.closest.ref.index;
        if (errors[index]) {
          if (error.score > errors[index].score) {
            delete errors[index];
          } else {
            delete errors[i];
          }
        }
      });
    }
Dedupe errors, only keep the ones with the highest score and delete the others