mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-03 13:45:59 +01:00
12 lines
339 B
JavaScript
12 lines
339 B
JavaScript
|
export default function middlewarePipeline(context, middleware, index) {
|
||
|
const nextMiddleware = middleware[index];
|
||
|
if (!nextMiddleware) {
|
||
|
return context.next;
|
||
|
}
|
||
|
return () => {
|
||
|
nextMiddleware({
|
||
|
...context,
|
||
|
next: middlewarePipeline(context, middleware, index + 1),
|
||
|
});
|
||
|
};
|
||
|
}
|