Object.mixin/Object.assing with multiple args

Rick Waldron waldron.rick at gmail.com
Wed May 22 17:53:44 PDT 2013


On Wed, May 22, 2013 at 7:48 PM, Dmitry Soshnikov <
dmitry.soshnikov at gmail.com> wrote:

> Hello,
>
> It's very likely it was (should have been I believe) discussed before, and
> even probably was approved, but I don't see it in the latest draft yet.
>

The following has been discussed, but...


>
> Just to make sure, the signature of the "assign" and "mixin" method should
> be:
>
> Object.assign(target, source,[source2, ..., sourceN]);
> Object.mixin(target, source,[source2, ..., sourceN]);
>
> Current draft shows me only one source for both the methods.
>

That's correct. The third argument is being reserved for a descriptor map
(potentially). Object.assign is not specified to match the _exact_
behaviour of any existing object "merge", "extend", "mixin" operation.

This is not unreasonable:

function merge(target, ...sources) {
  return sources.reduce(Object.assign, target);
}


Rick




>
>
> Dmitry
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130522/7cdb9261/attachment.html>


More information about the es-discuss mailing list