Skip to content

Instantly share code, notes, and snippets.

@sixolet
Created March 12, 2013 01:21
Show Gist options
  • Save sixolet/5139496 to your computer and use it in GitHub Desktop.
Save sixolet/5139496 to your computer and use it in GitHub Desktop.
Creates a function to shove a prototype on an object.
var addMethods = function (proto) {
var Constr = function (obj) {
_.extend(this, obj);
};
Constr.prototype = proto;
return function (obj) { return new Constr(obj); };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment