-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: crashes on IE11 and ReflectMetadata typings
- Loading branch information
Alexandr Rodik
committed
Aug 8, 2017
1 parent
a48f462
commit 65b037b
Showing
4 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export function findFirst<T>(array: Array<T>, expression: (value: T) => boolean): T { | ||
if (!angular.isFunction(expression)) { | ||
let first = array[0]; | ||
if (!first) { | ||
return null; | ||
} | ||
return first; | ||
} | ||
for (let i = 0; i < array.length; i++) { | ||
if (expression(array[i])) { | ||
return array[i]; | ||
} | ||
} | ||
return null; | ||
} |