Skip to content

Instantly share code, notes, and snippets.

@dogeared
Created January 8, 2013 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dogeared/4485237 to your computer and use it in GitHub Desktop.
Save dogeared/4485237 to your computer and use it in GitHub Desktop.
var _ = require('underscore')
var levers = [
{ id: '1', val: 'one'},
{ id: '2', val: 'two'},
{ id: '3', val: 'three'},
]
var ids = ['1', '3']
var result = _.map(levers, function(lever) {
return (ids.indexOf(lever.id)<0)?null:lever
})
console.dir(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment