Skip to content

Instantly share code, notes, and snippets.

@BrettBukowski
Created January 6, 2015 21:58
Show Gist options
  • Save BrettBukowski/75f126a85fb3c03cc65a to your computer and use it in GitHub Desktop.
Save BrettBukowski/75f126a85fb3c03cc65a to your computer and use it in GitHub Desktop.
JS extend
"use strict";
module.exports = function (props) {
var self = this;
function Child () {
self.call(this);
}
Child.prototype = Object.create(self.prototype);
for (var i in props) {
Child.prototype[i] = props[i];
}
return Child;
};
// var extend = require('./extend');
// function Parent () {}
// Parent.extend = extend;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment