From 79fcba9fdbec031c81435075d26e1ee6e75467b5 Mon Sep 17 00:00:00 2001 From: kionell Date: Thu, 18 Aug 2022 00:34:06 +0300 Subject: [PATCH] Export binary search predicate type --- src/Utils/BinarySearch.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utils/BinarySearch.ts b/src/Utils/BinarySearch.ts index 94905a2..be0aa14 100644 --- a/src/Utils/BinarySearch.ts +++ b/src/Utils/BinarySearch.ts @@ -1,6 +1,6 @@ import { ControlPoint } from '../Beatmaps/ControlPoints/ControlPoint'; -type Predicate = (value: T, index: number, arr: T[]) => boolean; +export type BinarySearchPredicate = (value: T, index: number, arr: T[]) => boolean; /** * Searches an entire one-dimensional sorted array for a specific value. @@ -91,7 +91,7 @@ export function findControlPoint(arr: ControlPoint[], time: number): ControlPoin * @param predicate Predicate function. * @returns Found index or -1. */ -export function findIndex(arr: T[], predicate: Predicate): number { +export function findIndex(arr: T[], predicate: BinarySearchPredicate): number { let l = -1; let r = arr.length - 1;