just move a single repository up

This commit is contained in:
Joao Moreno
2017-12-15 15:21:31 +01:00
parent 71701f982d
commit 920a282c16
2 changed files with 17 additions and 25 deletions

View File

@@ -195,6 +195,16 @@ export function uniqueFilter<T>(keyFn: (t: T) => string): (t: T) => boolean {
};
}
export function firstIndex<T>(array: T[], fn: (t: T) => boolean): number {
for (let i = 0; i < array.length; i++) {
if (fn(array[i])) {
return i;
}
}
return -1;
}
export function find<T>(array: T[], fn: (t: T) => boolean): T | undefined {
let result: T | undefined = undefined;