Tweaks to left pane snapping logic
This commit is contained in:
parent
29e6ba8f10
commit
0faeda28f0
3 changed files with 51 additions and 8 deletions
13
ts/util/isSorted.ts
Normal file
13
ts/util/isSorted.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export function isSorted(list: Iterable<number>): boolean {
|
||||
let previousItem: undefined | number;
|
||||
for (const item of list) {
|
||||
if (previousItem !== undefined && item < previousItem) {
|
||||
return false;
|
||||
}
|
||||
previousItem = item;
|
||||
}
|
||||
return true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue