Skip to content

Commit

Permalink
Export binary search predicate type
Browse files Browse the repository at this point in the history
  • Loading branch information
kionell committed Aug 17, 2022
1 parent 5d75451 commit 79fcba9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Utils/BinarySearch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ControlPoint } from '../Beatmaps/ControlPoints/ControlPoint';

type Predicate<T> = (value: T, index: number, arr: T[]) => boolean;
export type BinarySearchPredicate<T> = (value: T, index: number, arr: T[]) => boolean;

/**
* Searches an entire one-dimensional sorted array for a specific value.
Expand Down Expand Up @@ -91,7 +91,7 @@ export function findControlPoint(arr: ControlPoint[], time: number): ControlPoin
* @param predicate Predicate function.
* @returns Found index or -1.
*/
export function findIndex<T>(arr: T[], predicate: Predicate<T>): number {
export function findIndex<T>(arr: T[], predicate: BinarySearchPredicate<T>): number {
let l = -1;
let r = arr.length - 1;

Expand Down

0 comments on commit 79fcba9

Please sign in to comment.