Respond to PR feedback.

This commit is contained in:
Sam Rose 2024-07-10 10:50:05 +01:00
parent 07a3030536
commit 114edc8954
No known key found for this signature in database
1 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ import {
import dayjs from "dayjs" import dayjs from "dayjs"
import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants" import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants"
import { deepGet, schema } from "./helpers" import { deepGet, schema } from "./helpers"
import _ from "lodash" import { isPlainObject, isEmpty, isArray } from "lodash"
const HBS_REGEX = /{{([^{].*?)}}/g const HBS_REGEX = /{{([^{].*?)}}/g
@ -335,7 +335,7 @@ export function fixupFilterArrays(filters: SearchFilters) {
] ]
for (const searchField of arrayFields) { for (const searchField of arrayFields) {
const field = filters[searchField] const field = filters[searchField]
if (field == null) { if (field == null || !isPlainObject(field)) {
continue continue
} }
@ -444,11 +444,11 @@ export const runQuery = (docs: Record<string, any>[], query: SearchFilters) => {
return false return false
} }
if (_.isObject(testValue.low) && _.isEmpty(testValue.low)) { if (isPlainObject(testValue.low) && isEmpty(testValue.low)) {
testValue.low = undefined testValue.low = undefined
} }
if (_.isObject(testValue.high) && _.isEmpty(testValue.high)) { if (isPlainObject(testValue.high) && isEmpty(testValue.high)) {
testValue.high = undefined testValue.high = undefined
} }