Created
June 21, 2011 00:13
-
-
Save vladocar/1036935 to your computer and use it in GitHub Desktop.
Multi extend object All
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 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