1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const lodash_1 = require("./wrap/lodash");
|
4 | const function_1 = require("./function");
|
5 | const imitate_1 = require("./imitate");
|
6 | exports.default = (typeOrNames) => lodash_1.default.isFunction(typeOrNames)
|
7 | ? (0, imitate_1.default)(typeOrNames)
|
8 | : fakeConstructorFromNames(typeOrNames);
|
9 | const fakeConstructorFromNames = (funcNames) => {
|
10 | return lodash_1.default.tap((0, function_1.default)('(unnamed constructor)'), (fakeConstructor) => {
|
11 | fakeConstructor.prototype.toString = () => '[test double instance of constructor]';
|
12 | lodash_1.default.each(funcNames, (funcName) => {
|
13 | fakeConstructor.prototype[funcName] = (0, function_1.default)(`#${String(funcName)}`);
|
14 | });
|
15 | });
|
16 | };
|