Skip to content

Commit 890da1d

Browse files
committed
fix: simplify combining LocaleTexts
Use array mapping and joining
1 parent 989fd38 commit 890da1d

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

resources/responses.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,9 @@ const combineLocaleText = (first: LocaleText, rest: LocaleTextWithSeparator[]):
178178

179179
const result: Record<string, string> = {};
180180
for (const lang of langs) {
181-
let combined = '';
182-
for (const [sep, text] of parts) {
183-
combined += sep;
184-
combined += text[lang] ?? text.en;
185-
}
186-
187-
result[lang] = combined;
181+
result[lang] = parts
182+
.map(([sep, text]) => `${sep}${text[lang] ?? text.en}`)
183+
.join('');
188184
}
189185

190186
return result as LocaleText;

0 commit comments

Comments
 (0)