Object.assign( target, source )
Rough spec expectations:
- Only enumerable own properties of source
- Invoke [[Get]] on property list derived from source, for each property in list [[Put]] on target
- private names are not copied
- unique names are copied
- super mechanism (rebind super)… AWB To determine needs
- Returns modified "target"
I've implemented
_.extend
and_.defaults
to followObject.assign
and iterate only own properties in Lo-Dash v0.10.0+. The only real issue I've seen is in @tbranyen's backbone.layoutmanager which had to implement a customaugment
method to normalize the behavior of Underscore/Lo-Dash because there was code that passed objects with inherited properties to_.extend
.Btw +1 on allowing multiple sources (
_.extend
and_.defaults
allow it too).