11 lines
213 B
JavaScript
Raw Normal View History

2021-02-11 21:31:41 +08:00
function toFactory(Class) {
const Factory = function(...args) {
return new Class(...args)
}
Factory.__proto__ = Class
Factory.prototype = Class.prototype
return Factory
}
module.exports = toFactory