Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _activatePreviousItem(): void {
// Bail if there are no search results.
if (!this._results || this._results.length === 0) {
return;
}
// Find the previous enabled item index.
let ai = this._activeIndex;
let n = this._results.length;
let start = ai <= 0 ? n - 1 : ai - 1;
let stop = start === n - 1 ? 0 : start + 1;
this._activeIndex = ArrayExt.findLastIndex(
this._results, Private.canActivate, start, stop
);
// Schedule an update of the items.
this.update();
}
activatePreviousItem(): void {
let n = this._items.length;
let ai = this._activeIndex;
let start = ai <= 0 ? n - 1 : ai - 1;
let stop = start === n - 1 ? 0 : start + 1;
this.activeIndex = ArrayExt.findLastIndex(
this._items, Private.canActivate, start, stop
);
}