UNPKG

@aikidosec/firewall

Version:

Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks

20 lines (19 loc) 666 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isDeprecatedGenerator = isDeprecatedGenerator; /* eslint-disable func-names */ /** * Checks if a function is a generator function. * They are deprecated in koa v2 and are already removed in the main branch (will be completely removed in v3). */ function isDeprecatedGenerator(fn) { const GeneratorFunction = function* () { }.constructor; if (fn instanceof GeneratorFunction) { return true; } const AsyncGeneratorFunction = async function* () { }.constructor; if (fn instanceof AsyncGeneratorFunction) { return true; } return false; }