Skip to content

Instantly share code, notes, and snippets.

@wheeyls
Created March 10, 2013 21:07
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 wheeyls/5130421 to your computer and use it in GitHub Desktop.
Save wheeyls/5130421 to your computer and use it in GitHub Desktop.
(function () {
var initializing = false
, superPattern = /xyz/.test(function () { xyz; }) ? /\b_super\b/ : /.*/;
Object.subClass = function (properties) {
var _super = this.prototype;
initializing = true;
var proto = new this();
initializing = false;
for (var name in properties) {
proto[name] = typeof properties[name] == 'function' &&
typeof _super[name] == 'function' &&
superPattern.test(properties[name]) ?
(function (name, fn) {
}(name, properties[name])) :
properties[name];
}
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment