We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8598192 commit 07c1373Copy full SHA for 07c1373
misc/deduplicate_errors.ts
src/translator/translator.ts
@@ -1,6 +1,6 @@
1
import { distinct } from "@std/collections/distinct";
2
+import { distinctBy } from "@std/collections/distinct-by";
3
import { shuffle } from "@std/random/shuffle";
-import { deduplicateErrors } from "../../misc/deduplicate_errors.ts";
4
import { errors } from "../../telo_misikeke/telo_misikeke.js";
5
import { ArrayResult, ArrayResultError } from "../array_result.ts";
6
import { parser } from "../parser/parser.ts";
@@ -31,3 +31,6 @@ export function translate(tokiPona: string): ArrayResult<string> {
31
return ArrayResult.errors(error);
32
}
33
34
+function deduplicateErrors<const T extends Error>(errors: Iterable<T>) {
35
+ return distinctBy(errors, ({ message }) => message);
36
+}
0 commit comments