Skip to content

Instantly share code, notes, and snippets.

@wellington1993
Last active May 13, 2016 17:18
Show Gist options
  • Save wellington1993/94b2092470888f48e05ef8bcb7671522 to your computer and use it in GitHub Desktop.
Save wellington1993/94b2092470888f48e05ef8bcb7671522 to your computer and use it in GitHub Desktop.
Tests with Lodash array
//Subtract the $scope.mission.astronauts array from all_astronauts array.
//The Astronaut inside all_astronauts are different as $scope.mission.astronauts astronaut
// but have some id
mission_astronauts_ids = _.map($scope.mission.astronauts,"id")
diff_astronauts = _.filter(all_astronauts, function(astronaut){
return mission_astronauts.indexOf(astronaut.id) >= 0
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment