testdouble
Version:
A minimal test double library for TDD with JavaScript
19 lines (18 loc) • 577 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const generatorsAreSupported = (function () {
try {
eval('(function* () {})'); // eslint-disable-line
return true;
}
catch (e) {
return false;
}
})();
const GeneratorFunction = (function () {
if (!generatorsAreSupported)
return;
const func = eval('(function* () {})'); // eslint-disable-line
return Object.getPrototypeOf(func).constructor;
})();
exports.default = (func) => generatorsAreSupported && func.constructor === GeneratorFunction;
;