Implement a function asyncMap
.
This function produces an array of values by mapping each value in arr
through the iteratee
function in parallel. The iteratee
function accepts a first argument an item from arr
and a Node.js style callback (accepting an error as first argument or null and the mapped item as second argument). If the iteratee
produces a error the main callback
is invoked with the error as first argument, otherwise the main callback
is invoked with null as first argument and the array of mapped items as second argument.
function asyncMap(arr, fn, cb) {
// TODO