Re: Proposal: syntactic sugar for extracting fields from objects

2019-05-28 Thread Григорий Карелин
Here are another examples, where "destructuring picking" I suggest whould be helpful. ==1A Now (redux related) ``` function mapStateToProps({user: {firstName, lastName}, common: {currentPageURL: url}}) { return {firstName, lastName, url}; } ``` ==1B Proposal ``` function mapStateToProps(state) {

Re: Proposal: syntactic sugar for extracting fields from objects

2019-05-28 Thread guest271314
> > ``` >> let obj = {otherData: "other data"}; >> ({firstName:obj.firstName, lastName:obj.lastName} = user.profile); >> ``` > > I don't understand this. > > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names He's

Re: Proposal: syntactic sugar for extracting fields from objects

2019-05-28 Thread Bob Myers
> > ``` > let obj = {otherData: "other data"}; > ({firstName:obj.firstName, lastName:obj.lastName} = user.profile); > ``` > I don't understand this. > Alternatively there are various approaches which can be used to get only > specific properties from an abject and set those properties and

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

2019-05-28 Thread Joseph Rocca
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