UNPKG

testdouble

Version:

A minimal test double library for TDD with JavaScript

18 lines (15 loc) 456 B
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 })() export default (func) => generatorsAreSupported && func.constructor === GeneratorFunction