Skip to content

Commit ec2d12b

Browse files
committed
guard instead of if block
1 parent 0ebcb92 commit ec2d12b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/dropdown/list/dropdown-list.component.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,11 @@ export class DropdownList implements AbstractDropdownView, AfterViewInit, OnDest
212212
this.index = this._items.findIndex(item => item.selected);
213213
this.setupFocusObservable();
214214
setTimeout(() => {
215-
if (this.getSelected()) {
216-
if (this.type === "single") {
217-
this.select.emit({ item: this._items.find(item => item.selected) });
218-
} else {
219-
this.select.emit(this.getSelected() || []);
220-
}
215+
if (!this.getSelected()) { return; }
216+
if (this.type === "single") {
217+
this.select.emit({ item: this._items.find(item => item.selected) });
218+
} else {
219+
this.select.emit(this.getSelected() || []);
221220
}
222221
});
223222
}

0 commit comments

Comments
 (0)