Proposal: `Array.prototype.chunks` and `Array.prototype.windows`

Joseph Rocca rocca.joseph at gmail.com
Tue May 28 10:05:21 UTC 2019


Apologies if this has already been suggested and discussed somewhere, but I
couldn't find anything. I'm learning Rust at the moment, and found myself
wishing that JavaScript had `chunks` and `windows` array methods.

https://doc.rust-lang.org/std/primitive.slice.html#method.windows

https://doc.rust-lang.org/std/primitive.slice.html#method.chunks

A `swap` method (like Rust's) might be handy too. Has there been any
discussion on new array methods like this? I think it's great that slice
notation and range() type stuff
<https://github.com/tc39/proposal-slice-notation/issues/19#issuecomment-421453934>
is
being discussed, and I think it would be neat if JavaScript got some more
array-manipulation features to make wrangling data more pleasant.

Any thoughts?

Cheers,
Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190528/259b1d04/attachment.html>


More information about the es-discuss mailing list