replaced underscore with lodash, expanded querying capability to search through nested objects and arrays

This commit is contained in:
Ryan Crosser
2015-05-23 10:26:56 -04:00
parent 7af6e40a84
commit db7712ac11
3 changed files with 44 additions and 23 deletions

View File

@ -1,7 +1,7 @@
var express = require('express')
var methodOverride = require('method-override')
var bodyParser = require('body-parser')
var _ = require('underscore')
var _ = require('lodash')
var low = require('lowdb')
var pluralize = require('pluralize')
var utils = require('./utils')
@ -78,7 +78,7 @@ module.exports = function (source) {
array = db(req.params.resource).filter(function (obj) {
for (var key in obj) {
var value = obj[key]
if (_.isString(value) && value.toLowerCase().indexOf(q) !== -1) {
if(utils.deepQuery(value, q)){
return true
}
}