Re: Object copy

2014-06-11 Thread Maxime Warnier
Thanks for your answers. Object.assign seems good but provides only copy for enumerable properties, not a real deep clone. I know for jquery, that's why i precised only for DOM but it was just to show the syntax :) 2014-06-11 0:00 GMT+02:00 Rick Waldron waldron.r...@gmail.com: On Tue, Jun

Re: Object copy

2014-06-11 Thread David Bruant
Hi Maxime, Good to see you here :-) This topic has been discussed recently on Twitter. See https://twitter.com/jeremyckahn/status/474259042005553154 I'm like Rick's answer in particular https://twitter.com/rwaldron/status/475017360085364736 as I believe a large share of cloning is just about

Re: Object copy

2014-06-11 Thread Maxime Warnier
Hi David :) thanks for the links ! You are right, it's generally about data. Serialize an object to JSON prevent from sharing references. On the twitter feed Jeremy talks about optimizing the process . I'm agree with that, for performance and a nicer syntax. By the way, the Object.deepFreeze is

Re: Object copy

2014-06-11 Thread Rick Waldron
On Wednesday, June 11, 2014, Maxime Warnier mar...@gmail.com wrote: Thanks for your answers. Object.assign seems good but provides only copy for enumerable properties, not a real deep clone. I know for jquery, that's why i precised only for DOM but it was just to show the syntax :) Oops,

Object copy

2014-06-10 Thread Maxime Warnier
Hi All Do you know if it is planned or maybe in discussion for ES7 to have a simple clone system on objects ? There are different notations, from : - jquery Object.clone( [withDataAndEvents ] [, deepWithDataAndEvents ] ) ( but only for DOM element ) - underscore _.clone(object) ( return

Re: Object copy

2014-06-10 Thread Alex Kocharin
 Object.create() ? It's not exactly cloning, but it'll probably work better than cloning in most cases.  10.06.2014, 20:33, "Maxime Warnier" mar...@gmail.com:Hi All Do you know if it is planned or maybe in discussion for ES7 to have a simple clone system on objects ? There are different notations,

Re: Object copy

2014-06-10 Thread Mameri, Fred (HBO)
@mozilla.orgmailto:es-discuss@mozilla.org Subject: Re: Object copy I'd like Object.merge(source, dest), and Object.clone(source). Object.clone would be best if it cloned almost any object, like more advanced clone functions. This includes plain objects, arrays, instances of classes (preserving

Re: Object copy

2014-06-10 Thread C. Scott Ananian
On Tue, Jun 10, 2014 at 2:47 PM, Frankie Bagnardi f.bagna...@gmail.com wrote: I'd like Object.merge(source, dest), and Object.clone(source). `Object.assign` is already in the ES6 spec. --scott ___ es-discuss mailing list es-discuss@mozilla.org

Re: Object copy

2014-06-10 Thread Rick Waldron
On Tue, Jun 10, 2014 at 12:32 PM, Maxime Warnier mar...@gmail.com wrote: Hi All Do you know if it is planned or maybe in discussion for ES7 to have a simple clone system on objects ? There are different notations, from : - jquery Object.clone( [withDataAndEvents ] [,