mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 04:32:24 +08:00
replaced underscore with lodash, expanded querying capability to search through nested objects and arrays
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user