Skip to content

Commit

Permalink
Simplify getFilterPath checks
Browse files Browse the repository at this point in the history
Co-authored-by: Hannes Küttner <4376726+hanneskuettner@users.noreply.github.com>
  • Loading branch information
paescuj and hanneskuettner committed May 7, 2024
1 parent ab05f68 commit e9280b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/src/utils/apply-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,11 @@ function getFilterPath(key: string, value: Record<string, any>) {
const path = [key];
const childKey = Object.keys(value)[0];

if (typeof childKey === 'string' && childKey.startsWith('_') === true && !['_none', '_some'].includes(childKey)) {
if (!childKey || (childKey.startsWith('_') === true && !['_none', '_some'].includes(childKey))) {
return path;
}

if (childKey && isPlainObject(value)) {
if (isPlainObject(value)) {
path.push(...getFilterPath(childKey, Object.values(value)[0]));
}

Expand Down

0 comments on commit e9280b9

Please sign in to comment.