Skip to content

Instantly share code, notes, and snippets.

View belaczek's full-sized avatar
😁

Tomas Belada belaczek

😁
View GitHub Profile

Keybase proof

I hereby claim:

  • I am belaczek on github.
  • I am belaczek (https://keybase.io/belaczek) on keybase.
  • I have a public key whose fingerprint is 1736 65CE 876D 43A1 E415 3A67 1EDD F060 29C4 A3A6

To claim this, I am signing this object:

@belaczek
belaczek / asyncMap.js
Last active July 25, 2017 11:02
Two async map solutions with basic currying support
/**
* Async map function with currying support
* @param fn
* @param arr
* @return {function(*=)}
*/
export const asyncMap = (fn, arr) => {
const asyncMapHelper = async arr => {
const promiseArray = Array.prototype.map.call(arr, async x => fn(x));
return await Promise.all(promiseArray);