On Tue, Oct 7, 2014 at 11:59 AM, Dmitry Soshnikov < [email protected]> wrote:
> On Tue, Oct 7, 2014 at 11:56 AM, Claude Pache <[email protected]> > wrote: > > >> >> >> > Le 7 oct. 2014 à 20:36, Dmitry Soshnikov <[email protected]> >> a écrit : >> > >> > And other things are better be written: >> > >> > ``` >> > <ArrayKind>.from(iterable).map(mapfn) >> > ``` >> > >> > Am I still missing something? >> >> Yes: `UInt32Array.from(['a', 'b', 'c], x => x.codePointAt(0))` >> >> > Still seems the same as `NodeList` "issue": > > ``` > UInt32Array.from(['a', 'b', 'c].map(x => x.codePointAt(0))); > ``` > And after you have fed the data the `UInt32Array` expects, you can post-map it as well: ``` UInt32Array.from(['a', 'b', 'c].map(x => x.codePointAt(0))).map(v => v * 2); ``` What's is wrong in here? We don't have "too much of responsibility" anti-pattern, explicitly separate the transformation form mapping, and explicitly say what the format of data a particular constructor expects (thus, mapping it before passing, as it should be). Dmitry
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

