Skip to content

Commit 07c1373

Browse files
committed
refactor misc functions
1 parent 8598192 commit 07c1373

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

misc/deduplicate_errors.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/translator/translator.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { distinct } from "@std/collections/distinct";
2+
import { distinctBy } from "@std/collections/distinct-by";
23
import { shuffle } from "@std/random/shuffle";
3-
import { deduplicateErrors } from "../../misc/deduplicate_errors.ts";
44
import { errors } from "../../telo_misikeke/telo_misikeke.js";
55
import { ArrayResult, ArrayResultError } from "../array_result.ts";
66
import { parser } from "../parser/parser.ts";
@@ -31,3 +31,6 @@ export function translate(tokiPona: string): ArrayResult<string> {
3131
return ArrayResult.errors(error);
3232
}
3333
}
34+
function deduplicateErrors<const T extends Error>(errors: Iterable<T>) {
35+
return distinctBy(errors, ({ message }) => message);
36+
}

0 commit comments

Comments
 (0)