We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var arr = [func1, func2, func3]; function func1(ctx, next) { ctx.index++ next(); } function func2(ctx, next) { setTimeout(function () { ctx.index++; next(); }); } function func3(ctx, next) { console.log(ctx.index); } const compose = arr => arr.reverse().reduce((a, b) => obj => b(obj, () => a(obj)), () => { }) compose(arr)({ index: 0 }); // 输出:2 /* function compose(arr) { return arr.reverse().reduce((a, b) => { return function (obj) { b(obj, function () { a(obj) }) } }, () => { }) } */
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: