From e9f98de94a4e6e23d035f4af177ed952108a48ee Mon Sep 17 00:00:00 2001 From: Johan Nyman Date: Tue, 24 Feb 2026 08:10:03 +0100 Subject: [PATCH] Fix import issue for generator-function Fix import for generator-function module. This is a hack to avoid a breaking change introduced in v1.1.1, #5477ff1 --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index f7a4859..414e9f6 100644 --- a/index.js +++ b/index.js @@ -11,6 +11,9 @@ var fnToStr = callBound('Function.prototype.toString'); var getGeneratorFunction = require('generator-function'); +// Hack to fix import, see https://github.com/inspect-js/is-generator-function/issues/45 +if (typeof getGeneratorFunction === 'object' && typeof getGeneratorFunction.default === 'function') getGeneratorFunction = getGeneratorFunction.default + /** @type {import('.')} */ module.exports = function isGeneratorFunction(fn) { if (typeof fn !== 'function') {