Skip to content

Instantly share code, notes, and snippets.

@IPRIT
Created April 11, 2015 19:19
Show Gist options
  • Select an option

  • Save IPRIT/8625fbc68858129d47b2 to your computer and use it in GitHub Desktop.

Select an option

Save IPRIT/8625fbc68858129d47b2 to your computer and use it in GitHub Desktop.
Map with reduce
module.exports = function map(arr, fn) {
return arr.reduce(function(acc, item, index, arr) {
return acc.concat(fn(item, index, arr));
}, []);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment