Skip to content

Commit 0633ca8

Browse files
committed
use set size instead
1 parent 861e2e4 commit 0633ca8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/translator/translator.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ export function translate(tokiPona: string): IterableResult<string> {
1919
const aggregateErrors: Array<ResultError> = [];
2020
const unique: Set<string> = new Set();
2121
if (settings.randomize) {
22-
let i = 0;
2322
for (const result of iterableResult.iterable()) {
24-
if (i >= RANDOMIZATION_LIMIT) {
23+
if (unique.size >= RANDOMIZATION_LIMIT) {
2524
yield {
2625
type: "error",
2726
error: new ResultError("too much output to shuffle"),
@@ -31,7 +30,6 @@ export function translate(tokiPona: string): IterableResult<string> {
3130
switch (result.type) {
3231
case "value":
3332
unique.add(result.value);
34-
i++;
3533
break;
3634
case "error":
3735
aggregateErrors.push(result.error);

0 commit comments

Comments
 (0)