remove Resource from git model method interfaces

This commit is contained in:
Joao Moreno
2017-08-15 11:53:35 +02:00
parent b9eb8baea5
commit acb83d00c0
3 changed files with 49 additions and 21 deletions

View File

@@ -162,4 +162,19 @@ export function uniqueFilter<T>(keyFn: (t: T) => string): (t: T) => boolean {
seen[key] = true;
return true;
};
}
export function find<T>(array: T[], fn: (t: T) => boolean): T | undefined {
let result: T | undefined = undefined;
array.some(e => {
if (fn(e)) {
result = e;
return true;
}
return false;
});
return result;
}