Microsoft/TypeScript — pull request #1372 by CyrusNajmabadi (2014-12-04 21:16:58+00:00)
Title: ForEach cleanup

forEach and forEachChild previously had the semantics:

return arr.length === 0 ? undefined : firstValueThatsTruthy || lastValueThatsFalsy()

That's some pretty odd semantics for the functions to have, and doesn't seem to match any function from pretty much any mainstream API out there. I've now changed the API to have the semantics:

return firstValueThatsTruthy() || undefined;

This is at least mostly similar to .Net's ```Enumerable.FirstOrDefault(this IEnumerable source, Func predicate)```