Last active
March 19, 2018 15:06
-
-
Save lmcarreiro/d1787a5f789e58f9fe28de6aac1ecbb2 to your computer and use it in GitHub Desktop.
Method declaration not column-indented
This file contains hidden or 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
| /** | |
| * Filters an array by a predicate function. Returns the same array instance if the predicate is | |
| * true for all elements, otherwise returns a new array instance containing the filtered subset. | |
| */ | |
| export function filter<T, U extends T>(array: T[], f: (x: T) => x is U): U[]; | |
| export function filter<T>(array: T[], f: (x: T) => boolean): T[]; | |
| export function filter<T, U extends T>(array: ReadonlyArray<T>, f: (x: T) => x is U): ReadonlyArray<U>; | |
| export function filter<T, U extends T>(array: ReadonlyArray<T>, f: (x: T) => boolean): ReadonlyArray<T>; | |
| export function filter<T>(array: T[], f: (x: T) => boolean): T[] { | |
| if (array) { | |
| const len = array.length; | |
| let i = 0; | |
| // ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment