UNPKG

577 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const generatorsAreSupported = (function () {
4 try {
5 eval('(function* () {})'); // eslint-disable-line
6 return true;
7 }
8 catch (e) {
9 return false;
10 }
11})();
12const GeneratorFunction = (function () {
13 if (!generatorsAreSupported)
14 return;
15 const func = eval('(function* () {})'); // eslint-disable-line
16 return Object.getPrototypeOf(func).constructor;
17})();
18exports.default = (func) => generatorsAreSupported && func.constructor === GeneratorFunction;