Skip to content

Instantly share code, notes, and snippets.

@PaulGuo
Created August 23, 2012 02:54
Show Gist options
  • Save PaulGuo/3431640 to your computer and use it in GitHub Desktop.
Save PaulGuo/3431640 to your computer and use it in GitHub Desktop.
__create
var __create = Object.create || function(proto, props) {
var ctor = function(ps) {
if(ps) Object.defineProperties(this, ps);
};
ctor.prototype = proto;
return new ctor(props);
};
var __extend = function(o, proto) {
o = o !== Object(o) ? {} : o;
if(o.__proto__) {
o.__proto__ = proto;
return o;
}
var n = __create(proto);
for(var i in o) {
if(o.hasOwnProperty(i)) {
n[i] = o[i];
}
}
return n;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment