Skip to content

Instantly share code, notes, and snippets.

@vladocar
Created June 21, 2011 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladocar/1036935 to your computer and use it in GitHub Desktop.
Save vladocar/1036935 to your computer and use it in GitHub Desktop.
Multi extend object All
function extendAll() {
var i = arguments.length;
function F() {}
function N() {}
while (i--) {
for (var method in arguments[i]) {
F.prototype[method] = arguments[i][method];
}
if (typeof arguments[i] !== "object") {
N.prototype = new arguments[i]();
for (var m in N.prototype) {
F.prototype[m] = N.prototype[m];
}
}
}
return new F();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment