Skip to content

Instantly share code, notes, and snippets.

@IvanGuardado
Last active August 29, 2015 14:02
Show Gist options
  • Save IvanGuardado/57518b37fa93e99aa778 to your computer and use it in GitHub Desktop.
Save IvanGuardado/57518b37fa93e99aa778 to your computer and use it in GitHub Desktop.
Node.js, The Bad Parts
//Example using a feasible
//implementation of Promise
function mapValues(){
var list = [1,2,3,4,5,6];
//doSomeAsyncTask returns a
//promise of type
//Promise[Array[Int]]
var values = doSomeAsyncTask(list);
//The map function will be executed
//when the promise is resolved
var mapped = values.map(Math.round);
//returns a promise of mapped values
return mapped;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment