With MojiScript I have created an async map, filter and reduce to make things like this cake.
map
filter
reduce
import map from 'mojiscript/list/map' const sleep = timeout => new Promise(resolve => setTimeout(resolve, timeout)) const array = [ 1, 2, 3 ] const asyncTransform = async x => { await sleep(1000) return x * 2 } map (asyncTransform) (array) //=> Promise ([ 2, 4, 6 ])
Check it out here: mojiscript.js.org/#/list-map
Also related: Why async code is so damn confusing (and a how to make it easy)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
With MojiScript I have created an async
map
,filter
andreduce
to make things like this cake.Check it out here: mojiscript.js.org/#/list-map
Also related: Why async code is so damn confusing (and a how to make it easy)