mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Convert sortedIndex.js to ts
This commit is contained in:
parent
ea0adb4407
commit
8a169d5ddc
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseObservableList} from "../../../../observable/list/BaseObservableList";
|
import {BaseObservableList} from "../../../../observable/list/BaseObservableList";
|
||||||
import {sortedIndex} from "../../../../utils/sortedIndex.js";
|
import {sortedIndex} from "../../../../utils/sortedIndex";
|
||||||
|
|
||||||
// maps 1..n entries to 0..1 tile. Entries are what is stored in the timeline, either an event or fragmentboundary
|
// maps 1..n entries to 0..1 tile. Entries are what is stored in the timeline, either an event or fragmentboundary
|
||||||
// for now, tileCreator should be stable in whether it returns a tile or not.
|
// for now, tileCreator should be stable in whether it returns a tile or not.
|
||||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseObservableList} from "./BaseObservableList";
|
import {BaseObservableList} from "./BaseObservableList";
|
||||||
import {sortedIndex} from "../../utils/sortedIndex.js";
|
import {sortedIndex} from "../../utils/sortedIndex";
|
||||||
import {findAndUpdateInArray} from "./common";
|
import {findAndUpdateInArray} from "./common";
|
||||||
|
|
||||||
export class SortedArray extends BaseObservableList {
|
export class SortedArray extends BaseObservableList {
|
||||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseObservableList} from "./BaseObservableList";
|
import {BaseObservableList} from "./BaseObservableList";
|
||||||
import {sortedIndex} from "../../utils/sortedIndex.js";
|
import {sortedIndex} from "../../utils/sortedIndex";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ limitations under the License.
|
|||||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||||
*/
|
*/
|
||||||
export function sortedIndex(array, value, comparator) {
|
export function sortedIndex<T>(array: T[], value: T, comparator: (x:T, y:T) => number): number {
|
||||||
let low = 0;
|
let low = 0;
|
||||||
let high = array.length;
|
let high = array.length;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user