Skip to content

Instantly share code, notes, and snippets.

@EduceHealth
Created June 7, 2014 00:27
Show Gist options
  • Save EduceHealth/fff41b8c656866482fee to your computer and use it in GitHub Desktop.
Save EduceHealth/fff41b8c656866482fee to your computer and use it in GitHub Desktop.
What to do instead of [for (var in collection)]
getSomeThings().then(function(things){
return things.map(function(aThing){
return OtherThing.find(aThing.id);
});
});
//Replaces
var thingIx, newThing, otherThings
getSomeThings()
.then(function(collection){
for(thingIx in collection) {
var newThing = OtherThing.find(collection[thingIx].id)
otherThings.push(newThing)
}
)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment