Skip to content

Instantly share code, notes, and snippets.

@davidcoallier
Created November 9, 2010 19:56
Show Gist options
  • Save davidcoallier/669703 to your computer and use it in GitHub Desktop.
Save davidcoallier/669703 to your computer and use it in GitHub Desktop.
So you miss your good old, jquery.extend?
Object.defineProperty(Object.prototype, "extend", {
enumerable: false,
value: function(from) {
var props = Object.getOwnPropertyNames(from);
var dest = this;
props.forEach(function(name) {
if (name in dest) {
sys.puts(sys.inspect(this));
var destination = Object.getOwnPropertyDescriptor(from, name);
Object.defineProperty(dest, name, destination);
}
});
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment