Hi,

We're currently polyfilling `Array.from` in our codebase following the
latest draft [1]. And I was actually surprised by the `mapfn` being
involved into the algorithm.

I mean, from the performance perspective it's probably .. ok-ish.. but from
the API design perspective it feels like combining the actual
transformation of an iterable (or of an array-like) with the mapping, is
the "too much of responsibility" anti-pattern. Why not filter then as well?
(or, as one of the comments on a diff review: "I'm actually disappointed it
won't do my laundry as well :P").

It probably should be just:

```
Array.from(...).map(mapfn);
```

Unless I'm missing something, and there was a special reason to include the
mapping.

Dmitry

[1] https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to