Skip to content

Instantly share code, notes, and snippets.

@abozhilov
Created April 29, 2012 23:09
Show Gist options
  • Save abozhilov/2553803 to your computer and use it in GitHub Desktop.
Save abozhilov/2553803 to your computer and use it in GitHub Desktop.
Function.prototype.factory
Function.prototype.factory = function () {
var cnt = this;
return function () {
var obj = Object.create(cnt.prototype);
cnt.apply(obj, arguments);
return obj;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment