Created
June 30, 2014 12:42
-
-
Save toddmotto/49c16d931a7380a1e661 to your computer and use it in GitHub Desktop.
Even smaller Object extend() method, with no reference cloning: http://jsfiddle.net/LR639
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extend (target, source) { | |
var a = Object.create(target); | |
Object.keys(source).map(function (prop) { | |
prop in a && (a[prop] = source[prop]); | |
}); | |
return a; | |
}; |
Hi @toddmotto! What you think about this?
function extend(target, source) {
return Object.assign({}, defaults, options);
};
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also i sounded quite arrogant there sorry, tried to change my comment but GitHub keeps throwing an error when i try :)