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
/* This WAS a two-line function until an awesome reddit user pointed out my logical flaw. Now It's a 5-line function :( */ | |
var Class = function(d){ | |
d.constructor.extend = function(def){ | |
for (var k in d) if (!def.hasOwnProperty(k)) def[k] = d[k]; | |
return Class(def); | |
}; | |
return (d.constructor.prototype = d).constructor; | |
}; |