Skip to content

Commit 46bc5d2

Browse files
committed
format
1 parent 7397d07 commit 46bc5d2

File tree

5 files changed

+41
-46
lines changed

5 files changed

+41
-46
lines changed

src/parser/lexer.ts

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const properWords = allAtLeastOnce(
6666
match(/[A-Z][a-zA-Z]*/, "proper word").skip(spaces),
6767
)
6868
.map((array) => array.join(" "))
69-
.map((words) => ({ type: "proper word", words, kind: "latin" }) );
69+
.map((words) => ({ type: "proper word", words, kind: "latin" }));
7070

7171
const specificWord = memoize((thatWord: string) =>
7272
word.filter((thisWord) =>
@@ -76,7 +76,7 @@ const specificWord = memoize((thatWord: string) =>
7676
);
7777
const multipleA = specificWord("a")
7878
.with(count(allAtLeastOnce(specificWord("a"))))
79-
.map((count) => ({ type: "multiple a", count: count + 1 }) );
79+
.map((count) => ({ type: "multiple a", count: count + 1 }));
8080
const repeatingLetter = match(/[a-zA-Z]/, "latin letter")
8181
.then(memoize((letter) =>
8282
count(all(matchString(letter)))
@@ -87,15 +87,15 @@ const longWord = allAtLeastOnce(repeatingLetter)
8787
.map((letters) => {
8888
const word = letters.map(([letter]) => letter).join("");
8989
const length = sumOf(letters, ([_, count]) => count) - word.length + 1;
90-
return { type: "long word", word, length } ;
90+
return { type: "long word", word, length };
9191
})
9292
.filter(({ word, length }) => /^[a-z]/.test(word) && length > 1);
9393

9494
const alaX = memoize((word: string) =>
9595
sequence(specificWord("ala"), specificWord(word)).map(() => word)
9696
);
9797
const xAlaX = lazy(() => settings.xAlaXPartialParsing ? empty : word.then(alaX))
98-
.map((word) => ({ type: "x ala x", word }) );
98+
.map((word) => ({ type: "x ala x", word }));
9999
const punctuation = choiceOnlyOne(
100100
allAtLeastOnce(
101101
match(SENTENCE_TERMINATOR, "punctuation")
@@ -105,7 +105,7 @@ const punctuation = choiceOnlyOne(
105105
.map((punctuation) => punctuation.join("").replaceAll("...", ELLIPSIS)),
106106
newline.map(() => "."),
107107
)
108-
.map((punctuation) => ({ type: "punctuation", punctuation }) );
108+
.map((punctuation) => ({ type: "punctuation", punctuation }));
109109
const cartoucheElement = choiceOnlyOne(
110110
singleUcsurWord
111111
.skip(match(NSK_COLON, "full width colon").skip(spaces)),
@@ -141,13 +141,11 @@ const cartouche = specificSpecialUcsur(START_OF_CARTOUCHE)
141141
);
142142
const cartouches = allAtLeastOnce(cartouche)
143143
.map((words) => words.join(" "))
144-
.map((words) =>
145-
({
146-
type: "proper word",
147-
words,
148-
kind: "cartouche",
149-
})
150-
);
144+
.map((words) => ({
145+
type: "proper word",
146+
words,
147+
kind: "cartouche",
148+
}));
151149
const longSpaceContainer = specificSpecialUcsur(START_OF_LONG_GLYPH)
152150
.with(count(spacesWithoutNewline).filter((length) => length > 0))
153151
.skip(specificSpecialUcsur(END_OF_LONG_GLYPH))
@@ -160,36 +158,34 @@ const spaceLongGlyph = sequence(
160158
longGlyphHead,
161159
longSpaceContainer,
162160
)
163-
.map(([words, spaceLength]) =>
164-
({
165-
type: "space long glyph",
166-
words,
167-
spaceLength,
168-
})
169-
);
161+
.map(([words, spaceLength]) => ({
162+
type: "space long glyph",
163+
words,
164+
spaceLength,
165+
}));
170166
const headedLongGlyphStart = longGlyphHead
171167
.skip(specificSpecialUcsur(START_OF_LONG_GLYPH))
172168
.skip(spaces)
173-
.map((words) => ({ type: "headed long glyph start", words }) );
169+
.map((words) => ({ type: "headed long glyph start", words }));
174170
const headlessLongGlyphEnd = specificSpecialUcsur(END_OF_LONG_GLYPH)
175171
.skip(spaces)
176-
.map(() => ({ type: "headless long glyph end" }) );
172+
.map(() => ({ type: "headless long glyph end" }));
177173
const headlessLongGlyphStart = specificSpecialUcsur(START_OF_REVERSE_LONG_GLYPH)
178174
.skip(spaces)
179-
.map(() => ({ type: "headless long glyph end" }) );
175+
.map(() => ({ type: "headless long glyph end" }));
180176
const headedLongGlyphEnd = specificSpecialUcsur(END_OF_REVERSE_LONG_GLYPH)
181177
.with(longGlyphHead)
182178
.skip(spaces)
183-
.map((words) => ({ type: "headed long glyph start", words }) );
179+
.map((words) => ({ type: "headed long glyph start", words }));
184180
const insideLongGlyph = specificSpecialUcsur(END_OF_REVERSE_LONG_GLYPH)
185181
.with(longGlyphHead)
186182
.skip(specificSpecialUcsur(START_OF_LONG_GLYPH))
187183
.skip(spaces)
188-
.map((words) => ({ type: "inside long glyph", words }) );
184+
.map((words) => ({ type: "inside long glyph", words }));
189185
const combinedGlyphsToken = combinedGlyphs
190186
.skip(spaces)
191-
.map((words) => ({ type: "combined glyphs", words }) );
192-
const wordToken = word.map((word) => ({ type: "word", word }) );
187+
.map((words) => ({ type: "combined glyphs", words }));
188+
const wordToken = word.map((word) => ({ type: "word", word }));
193189

194190
export const token: Parser<Token> = choiceOnlyOne<Token>(
195191
xAlaX,

src/parser/ucsur.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const SPECIAL_UCSUR_DESCRIPTIONS = {
3030
[END_OF_REVERSE_LONG_GLYPH]: "end of reverse long glyph",
3131
[UCSUR_MIDDLE_DOT]: "middle dot",
3232
[UCSUR_COLON]: "colon",
33-
} ;
33+
};
3434

3535
export type SpecialUcsur = keyof typeof SPECIAL_UCSUR_DESCRIPTIONS;
3636

@@ -183,8 +183,8 @@ export const KU_LILI = [
183183
];
184184
export const UCSUR_TO_LATIN = new Map(
185185
[
186-
{ start: 0xF1900, words: [...PU, ...KU_SULI] } ,
187-
{ start: 0xF19A0, words: KU_LILI } ,
186+
{ start: 0xF1900, words: [...PU, ...KU_SULI] },
187+
{ start: 0xF19A0, words: KU_LILI },
188188
]
189189
.flatMap(({ start, words }) =>
190190
words.map((latin, i) => [String.fromCodePoint(start + i), latin] as const)

src/settings_frontend.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ function loadOneFromElements<const T extends keyof Settings>(key: T) {
7777
);
7878
setIgnoreError(key, UPDATERS[key].stringify(settings[key]));
7979
}
80-
function setElement<const T extends keyof Settings>(key: T, value: Settings[T]) {
80+
function setElement<const T extends keyof Settings>(
81+
key: T,
82+
value: Settings[T],
83+
) {
8184
UPDATERS[key].set(
8285
document.getElementById(toKebabCase(key)) as
8386
| HTMLInputElement

src/translator/modifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function modifier(modifier: TokiPona.Modifier) {
170170
return pi(modifier.phrase);
171171
case "nanpa":
172172
return nanpa(modifier)
173-
.map((noun) => ({ type: "position phrase", noun }) );
173+
.map((noun) => ({ type: "position phrase", noun }));
174174
}
175175
}
176176
export function multipleModifiers(

src/translator/word_unit.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function defaultWordUnit(
3838
definition,
3939
emphasis: emphasis != null,
4040
})
41-
.map((noun) => ({ ...noun, type: "noun" }) );
41+
.map((noun) => ({ ...noun, type: "noun" }));
4242
}
4343
case "personal pronoun":
4444
return new ArrayResult([
@@ -49,38 +49,34 @@ function defaultWordUnit(
4949
emphasis: emphasis != null,
5050
}),
5151
type: "noun",
52-
} ,
52+
},
5353
]);
5454
case "adjective":
5555
if (!includeGerund && definition.gerundLike) {
5656
return ArrayResult.empty();
5757
} else {
5858
return adjective({ ...options, definition })
59-
.map((adjective) =>
60-
({
61-
type: "adjective",
62-
adjective,
63-
})
64-
);
59+
.map((adjective) => ({
60+
type: "adjective",
61+
adjective,
62+
}));
6563
}
6664
case "compound adjective":
6765
return compoundAdjective({
6866
...options,
6967
adjectives: definition.adjective,
7068
})
71-
.map((adjective) =>
72-
({
73-
type: "adjective",
74-
adjective,
75-
})
76-
);
69+
.map((adjective) => ({
70+
type: "adjective",
71+
adjective,
72+
}));
7773
case "verb":
7874
return partialVerb({
7975
...options,
8076
definition,
8177
emphasis: emphasis != null,
8278
})
83-
.map((verb) => ({ ...verb, type: "verb" }) );
79+
.map((verb) => ({ ...verb, type: "verb" }));
8480
default:
8581
return ArrayResult.empty();
8682
}

0 commit comments

Comments
 (0)