Re: Re: ES6 iteration over object values

2014-09-29 Thread Dmitry Soshnikov
Returning just arrays will be inconsistent with the same name methods that sit on prototypes of Array, Map, etc. Yes, Object.keys(...) poisons the iterators idea, but I think these better to be iterators. Or, if Object.values and Object.entries will start returning simple arrays (which of cours

Re: Re: ES6 iteration over object values

2014-09-28 Thread Mark Volkmann
What happened to adding the Object.values and Object.entries methods? There was some discussion that led me to believe these would be in ES6. Are they now targeted for ES7? -- R. Mark Volkmann Object Computing, Inc. ___ es-discuss mailing list

Re: Re: ES6 iteration over object values

2014-09-28 Thread Rick Waldron
On Sun, Sep 28, 2014 at 11:28 AM, Mark Volkmann r.mark.volkm...@gmail.com wrote: What happened to adding the Object.values and Object.entries methods? There was some discussion that led me to believe these would be in ES6. Are they now targeted for ES7? Yes, proposed by me and always for ES7

Re: ES6 iteration over object values

2014-03-16 Thread David Bruant
Le 16/03/2014 00:45, Rick Waldron a écrit : On Sat, Mar 15, 2014 at 7:38 PM, Jason Orendorff jason.orendo...@gmail.com mailto:jason.orendo...@gmail.com wrote: On Sat, Mar 15, 2014 at 5:19 PM, David Bruant bruan...@gmail.com mailto:bruan...@gmail.com wrote: Even if error prone,

Re: ES6 iteration over object values

2014-03-15 Thread David Bruant
Le 15/03/2014 01:32, Brandon Benvie a écrit : On 3/14/2014 5:16 PM, Mark Volkmann wrote: Does ES6 add any new ways to iterate over the values in an object? I've done a lot of searching, but haven't seen anything. I'm wondering if there is something more elegant than this:

Re: ES6 iteration over object values

2014-03-15 Thread David Bruant
Le 15/03/2014 22:51, C. Scott Ananian a écrit : It would be nicer to add an Object.entries() method that would return that iterator. Object.prototype.entries or Object.entries(obj)? That would be less error prone than adding a default iterator to every object. The world has survived

Re: ES6 iteration over object values

2014-03-15 Thread Jason Orendorff
On Sat, Mar 15, 2014 at 5:19 PM, David Bruant bruan...@gmail.com wrote: Even if error prone, I'd be interested to hear about arguments in the sense that the risk outweighs the benefits. Iterable-by-default objects is a nice battery included feature. I'm pretty sure es-discuss has been over

Re: ES6 iteration over object values

2014-03-15 Thread Rick Waldron
This thread's original question is answered by the Dict API ( https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-11/nov-29.md#conclusionresolution-5 ). (more inline below) On Sat, Mar 15, 2014 at 6:19 PM, David Bruant bruan...@gmail.com wrote: Le 15/03/2014 22:51, C. Scott Ananian a

Re: ES6 iteration over object values

2014-03-15 Thread Brendan Eich
Jason Orendorff wrote: I'd like to see an Object.entries method, and Object.values for completeness. Same visibility rules as Object.keys. for (let [k, v] of Object.entries(myObj)) { // do something with k and v } +1, or +2 counting static methods :-). /be

Re: ES6 iteration over object values

2014-03-15 Thread Rick Waldron
On Sat, Mar 15, 2014 at 7:38 PM, Jason Orendorff jason.orendo...@gmail.comwrote: On Sat, Mar 15, 2014 at 5:19 PM, David Bruant bruan...@gmail.com wrote: Even if error prone, I'd be interested to hear about arguments in the sense that the risk outweighs the benefits. Iterable-by-default

Re: ES6 iteration over object values

2014-03-15 Thread C. Scott Ananian
On Sat, Mar 15, 2014 at 6:19 PM, David Bruant bruan...@gmail.com wrote: Le 15/03/2014 22:51, C. Scott Ananian a écrit : It would be nicer to add an Object.entries() method that would return that iterator. Object.prototype.entries or Object.entries(obj)? `Object.entries(obj)` and

ES6 iteration over object values

2014-03-14 Thread Mark Volkmann
Does ES6 add any new ways to iterate over the values in an object? I've done a lot of searching, but haven't seen anything. I'm wondering if there is something more elegant than this: Object.keys(myObj).forEach(function (key) { let obj = myObj[key]; // do something with obj }); -- R. Mark

Re: ES6 iteration over object values

2014-03-14 Thread Brandon Benvie
On 3/14/2014 5:16 PM, Mark Volkmann wrote: Does ES6 add any new ways to iterate over the values in an object? I've done a lot of searching, but haven't seen anything. I'm wondering if there is something more elegant than this: Object.keys(myObj).forEach(function (key) { let obj = myObj[key];