Convert sortedIndex.js to ts

This commit is contained in:
RMidhunSuresh 2021-11-16 15:52:42 +05:30
parent ea0adb4407
commit 8a169d5ddc
4 changed files with 4 additions and 4 deletions

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
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
// for now, tileCreator should be stable in whether it returns a tile or not.

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import {BaseObservableList} from "./BaseObservableList";
import {sortedIndex} from "../../utils/sortedIndex.js";
import {sortedIndex} from "../../utils/sortedIndex";
import {findAndUpdateInArray} from "./common";
export class SortedArray extends BaseObservableList {

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import {BaseObservableList} from "./BaseObservableList";
import {sortedIndex} from "../../utils/sortedIndex.js";
import {sortedIndex} from "../../utils/sortedIndex";
/*

View file

@ -22,7 +22,7 @@ limitations under the License.
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* 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 high = array.length;