Created
June 7, 2014 00:27
-
-
Save EduceHealth/fff41b8c656866482fee to your computer and use it in GitHub Desktop.
What to do instead of [for (var in collection)]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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