@@ -303,37 +303,27 @@ class _KatexParser {
303303 case 'delimsizing' :
304304 // .delimsizing { ... }
305305 if (index + 1 > spanClasses.length) throw KatexHtmlParseError ();
306- switch (spanClasses[index++ ]) {
307- case 'size1' :
308- fontFamily = 'KaTeX_Size1' ;
309- case 'size2' :
310- fontFamily = 'KaTeX_Size2' ;
311- case 'size3' :
312- fontFamily = 'KaTeX_Size3' ;
313- case 'size4' :
314- fontFamily = 'KaTeX_Size4' ;
315-
316- case 'mult' :
306+ fontFamily = switch (spanClasses[index++ ]) {
307+ 'size1' => 'KaTeX_Size1' ,
308+ 'size2' => 'KaTeX_Size2' ,
309+ 'size3' => 'KaTeX_Size3' ,
310+ 'size4' => 'KaTeX_Size4' ,
311+ 'mult' =>
317312 // TODO handle nested spans with `.delim-size{1,4}` class.
318- throw KatexHtmlParseError ();
319-
320- default :
321- throw KatexHtmlParseError ();
322- }
313+ throw KatexHtmlParseError (),
314+ _ => throw KatexHtmlParseError (),
315+ };
323316
324317 // TODO handle .nulldelimiter and .delimcenter .
325318
326319 case 'op-symbol' :
327320 // .op-symbol { ... }
328321 if (index + 1 > spanClasses.length) throw KatexHtmlParseError ();
329- switch (spanClasses[index++ ]) {
330- case 'small-op' :
331- fontFamily = 'KaTeX_Size1' ;
332- case 'large-op' :
333- fontFamily = 'KaTeX_Size2' ;
334- default :
335- throw KatexHtmlParseError ();
336- }
322+ fontFamily = switch (spanClasses[index++ ]) {
323+ 'small-op' => 'KaTeX_Size1' ,
324+ 'large-op' => 'KaTeX_Size2' ,
325+ _ => throw KatexHtmlParseError (),
326+ };
337327
338328 // TODO handle more classes from katex.scss
339329
0 commit comments