Echo/node_modules/to-factory/to-factory.js
2021-02-11 21:31:41 +08:00

19 lines
434 B
JavaScript

"use strict";
var _bind = Function.prototype.bind;
function toFactory(Class) {
var Factory = function Factory() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return new (_bind.apply(Class, [null].concat(args)))();
};
Factory.__proto__ = Class;
Factory.prototype = Class.prototype;
return Factory;
}
module.exports = toFactory;