Skip to content

Instantly share code, notes, and snippets.

@mlakkadshaw
Last active February 3, 2016 20:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlakkadshaw/6850250 to your computer and use it in GitHub Desktop.
Save mlakkadshaw/6850250 to your computer and use it in GitHub Desktop.
Example of _.where clause
var data = [{model:"T", manufacturer: "ford"},
{model:"S", manufacturer:"tesla"},
{model:"r8", manufacturer:"audi"},
{model:"fiesta", manufacturer:"ford"}];
//Code to fetch all the ford cars
var fordCars = _.where(data, {manufacturer: "ford"});
//output
[{model:"fiesta", manufacturer:"ford"},{model:"T", manufacturer: "ford"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment