Object.define ==> Object.mixin??

Brandon Benvie brandon at brandonbenvie.com
Wed Dec 12 07:43:07 PST 2012

Works well as an arrow function due to not needing to turn it into a block
body, although forEach and a comma would work too.

Object.mixin = (target, source) =>
  Object.keys(source).reduce((target, key) =>
    Object.defineProperty(target, key,
Object.getOwnPropertyDescriptor(source, key))
   ), target);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121212/252179f0/attachment.html>

More information about the es-discuss mailing list