Skip to content

Commit 0ae4dd5

Browse files
committed
fix: keep hasDistinctValue changes minimal
1 parent ea3fa83 commit 0ae4dd5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/mongodb-query-util/src/has-distinct-value.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isPlainObject, some, isEqualWith } from 'lodash';
1+
import { isPlainObject, some, isEqualWith, has } from 'lodash';
22
import { bsonEqual } from './bson-equal';
33

44
/**
@@ -18,9 +18,9 @@ export const hasDistinctValue = (
1818
}
1919
// field is object, could be a $in clause or a primitive value
2020
if (isPlainObject(field)) {
21-
if ('$in' in field && Array.isArray(field.$in)) {
21+
if (has(field, '$in')) {
2222
// check if $in array contains the value
23-
const inArray = field.$in;
23+
const inArray = field.$in as object;
2424
return some(inArray, (other) => {
2525
return isEqualWith(value, other, bsonEqual);
2626
});

0 commit comments

Comments
 (0)