Function Composition with Pipes & Pattern Matching in JavaScript

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Thank you Jesse, was a good watch as usual. What I liked about compose is that the functions passed to is can be an array and you can lift these functions to handle for example promises. For example:

compose([one, two, three]);

If one returns a promise resolving in number but two expects a number you can do something like:

const liftPromise =

And for the compomse:

compose([one, two, three].map(liftPromise));

This was also useful when dealing with a promise represented as an object in redux like {loading, error, result} but you have functions that do not want to deal with the loading or error state, just the result. Just as with promises when loading or error it skips the rest and just returns that result. The railway orientated programming of Scott Wlaschin inspired me.

harmmeijer
Автор

Could you make a video on static folder wherein *(build.js, start.js, test.js )* files are in there ?
Those files handle my e-commerce website.

sachindramohansahay