Feature proposal

Nicolas B. Pierron nicolas.b.pierron at mozilla.com
Wed Jul 18 18:06:17 UTC 2018


On Wed, Jul 18, 2018 at 5:31 PM, Michael Luder-Rosefield
<rosyatrandom at gmail.com> wrote:
> At the moment, we have:
>
> every
> filter
> find
> findIndex
> forEach
> indexOf / lastIndexOf
> map
> reduce / reduceRight
> some
>
> which is not very consistent at all. Perhaps we could add an `iterOrder`
> method that changes the way the array is iterated through?

Stupid question, but why are some of these methods implemented on
String, Array, TypedArray, Map and Set, while all of them are
Iteratable?
If we were to add all these methods on Iteratable, then one could add
a `reverse` generator property on Iteratable.

  Iteratable.prototype.reverse = function* reverse() { … };
  foo.reverse().forEach( e => console.log(e) )

Though, this implies that all these objects implement the Iteratable
prototype, and I am not sure what impact this might have on the Web.

-- 
Nicolas B. Pierron


More information about the es-discuss mailing list