Skip to content

Instantly share code, notes, and snippets.

@toddmotto
Created June 30, 2014 12:42
Show Gist options
  • Save toddmotto/49c16d931a7380a1e661 to your computer and use it in GitHub Desktop.
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
function extend (target, source) {
var a = Object.create(target);
Object.keys(source).map(function (prop) {
prop in a && (a[prop] = source[prop]);
});
return a;
};
@HenriqueSilverio
Copy link

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