// the goodiesconstcallMethod=(methodName,...params)=>obj=>obj[methodName](...params)constawaitAll=promiseArray=>Promise.all(promiseArray)constprop=propName=>obj=>obj[propName]constmap=func=>arr=>arr.map(func)constpipe=(...functions)=>functions.reduce((compound,func)=>(input=>func(compound(input))))constdownload=url=>fetch(url).then(callMethod("json"))// the codedownload("http://swapi.co/api/people/2/").then(pipe(prop("films"),map(download),awaitAll,)).then(console.log).catch(console.error)
Even less cluttered than the async/await version, IMHO. You have prop, map and pipe in ramda, out of box.
With some goodies it can look like:
Even less cluttered than the async/await version, IMHO. You have
prop
,map
andpipe
in ramda, out of box.This is great!
I love what you've done here! 👏 so clean, so beautiful 🤩
That's some next level abstractions with currying and clever use of array methods!