node_modules ignore

This commit is contained in:
oier committed 2025-05-08 23:43:47 +02:00
1 parent e19d52f172
commit 4574544c9f
65041 files changed
+10593536

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
'use strict';
const helmet = require('helmet');
const { promisify } = require('util');
const koaHelmet = function () {
const helmetPromise = promisify(helmet.apply(null, arguments));
const middleware = (ctx, next) => {
return helmetPromise(ctx.req, ctx.res).then(next);
};
middleware._name = 'helmet';
return middleware;
};
Object.keys(helmet).forEach(function (helmetMethod) {
koaHelmet[helmetMethod] = function () {
const methodPromise = promisify(helmet[helmetMethod].apply(null, arguments));
return (ctx, next) => {
return methodPromise(ctx.req, ctx.res).then(next);
};
};
Object.keys(helmet[helmetMethod]).forEach((methodExports) => {
koaHelmet[helmetMethod][methodExports] = helmet[helmetMethod][methodExports];
});
});
module.exports = koaHelmet;