Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 16 lines (11 sloc) 342 Bytes
type SomeCallback<T> = (value: T, index: number, array: T[]) => boolean;
export function some<T>(array: T[], callback: SomeCallback<T>) {
const { length } = array;
for (let index = 0; index < length; index += 1) {
const value = array[index];
if (callback(value, index, array)) {
return true;
}
}
return false;
}
You can’t perform that action at this time.