On Oct 17, 2012, at 9:34 PM, Axel Rauschmayer wrote:
>> Pardon, I missed and cannot find what is Object.assign(...), seems it's not
>> from the latest draft. Is it just defining properties (via
>> Object.defineProperty) on from a source to destination object? Like old-good
>> Object.extend(...)?
>
> Explained here:
> https://github.com/rwldrn/tc39-notes/blob/master/es6/2012-09/sept-18.md
I see, thanks.
So, from what I see:
1. Source should not be the one. We should support many of sources to copy all
them at once:
Object.assign(dest, source1[, source2, ... sourceN])
In addition:
2. If the last parameter is boolean, then it's created as includeNonEnumerable:
Object.assign(desc, source1[, source2, ... sourceN, includeNonEnumerable);
Example;
Object.assign({a: 10}, {b: 20}, Object.defineProperties({}, {c: {value: 30}}),
true); // {a: 10, b: 20, c: 30}
Dmitry
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss