Created
May 12, 2014 01:50
-
-
Save taylonr/38ccb31aafbbb4bae813 to your computer and use it in GitHub Desktop.
underscore query
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
var _ = require('lodash'), | |
ActivityController = require('../../../controllers/activity.controller'), | |
FakeDatabase = [ | |
{userId: '123', Name: 'First Activity', Records: [{Date: new Date(2014, 1, 1)}]}, | |
{userId: '123', Name: 'Second Activity', Records: [{Date: new Date(2014, 2, 1)}]}]; | |
require('underscore-query')(_); | |
ActivityController.Activity.find = function(findObject, callback){ | |
var activities = _.query(FakeDatabase, findObject); | |
callback(null, activities); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment