Skip to content

Commit

Permalink
refactor(model): ♻️ use briefer switch cases (#90)
Browse files Browse the repository at this point in the history
Signed-off-by: Albert Mañosa <albertmasa2@gmail.com>
  • Loading branch information
albertms10 authored Nov 23, 2024
1 parent 8247b8c commit 03b172c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/src/model/definition_entry_senses.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ extension DefinitionEntrySenses on List<DefinitionEntrySense> {
final tempDefinitionElements = <Element>[];

for (final child in body.children) {
if (child.localName == 'br') {
if (tempDefinitionElements.isNotEmpty) {
switch (child) {
case Element(localName: 'br') when tempDefinitionElements.isNotEmpty:
definitions.add(tempDefinitionElements.toList());
tempDefinitionElements.clear();
}
continue;
}

if (child.localName == 'span') {
tempDefinitionElements.add(child);
case Element(localName: 'span'):
tempDefinitionElements.add(child);
}
}

Expand Down

0 comments on commit 03b172c

Please sign in to comment.