We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eee488c commit 30ddc26Copy full SHA for 30ddc26
src/util.ts
@@ -87,12 +87,9 @@ export class AsyncHooks {
87
88
_prepareHook(chain: Hook[]) {
89
return async function hook(...args: any[]): Promise<any> {
90
- return await next(0);
91
-
92
- async function next(i: number, result?: any): Promise<any> {
93
- const fn = chain[i];
94
- if (result !== undefined || fn === undefined) return result;
95
- return await new Promise(resolve => resolve(fn(...args))).then(next.bind(null, i + 1));
+ for (const fn of chain) {
+ const result = await Promise.resolve(fn(...args));
+ if (result !== undefined) return result;
96
}
97
};
98
0 commit comments