From: [email protected] [[email protected]] on behalf 
of Rick Waldron [[email protected]]

> Thanks, I've submitted an agenda item that includes _both_ find and findIndex.

Awesome!

One issue with `find` is what distinguishes

    find([1, 2, 3], x => isNaN(x)); // presumably `undefined`

from

    find([1, 2, undefined, 3], x => isNaN(x)); // also presumably `undefined`

i.e. how do you distinguish "found nothing" from "found `undefined`."

In C# they have `IEnumerable<T>.First` and `IEnumerable<T>.FirstOrDefault`; the 
former throws an error if nothing matching the predicate is found, whereas the 
latter returns `default(T)` (which is `null` for reference types, or `0` for 
numbers, etc.).

Food for thought.

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to