metarhia / metasync

Asynchronous Programming Library for JavaScript & Node.js
https://metarhia.com
MIT License
206 stars 35 forks source link

Simplify metasync syntax #318

Closed tshemsedinov closed 6 years ago

tshemsedinov commented 6 years ago

Now flow syntax is:

const f1 = (c, cb) => cb();
const f2 = (c, cb) => cb();
const f3 = (c, cb) => cb();
const f4 = (c, cb) => cb();
const fc = metasync([f1, f2, f3, f4]);
fc({}, (err, context) => {});

It will be good to have simplified syntax:

const f1 = cb => cb();
const f2 = cb => cb();
const f3 = cb => cb();
const f4 = cb => cb();
const fc = metasync([f1, f2, f3, f4]);
fc((err, context) => {});

Here are two optimizations:

tshemsedinov commented 6 years ago

Second case done, first case isn't implemented because it can affect performance.