Skip to content

Commit 0776542

Browse files
authored
Update lexicographically-smallest.ts
1 parent 81ad9c3 commit 0776542

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/utils/lexicographically-smallest.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ export function getLexicographicallySmallestInConcatenation(
6464
} else if (set.accept.isEmpty) {
6565
smallest.unshift(set.chars.ranges[0].min)
6666
} else {
67-
let words = set.accept.wordSets.map(
68-
(w): Word => w.map((c) => c.ranges[0].min),
69-
)
67+
let words = [
68+
...(set.chars.isEmpty ? [] : [[set.chars]]),
69+
...set.accept.wordSets,
70+
].map((w): Word => w.map((c) => c.ranges[0].min))
7071
// we only have to consider the lexicographically smallest words with unique length
7172
const seenLengths = new Set<number>()
7273
words = words.sort(compareWords).filter((w) => {

0 commit comments

Comments
 (0)