Skip to content

Commit

Permalink
use hasOwnProp
Browse files Browse the repository at this point in the history
  • Loading branch information
crcn committed Sep 24, 2021
1 parent 11a33e0 commit 028bc73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ const createNamedOperation = (

export const containsOperation = (query: any, options: Options) => {
for (const key in query) {
if (options.operations[key]) return true;
if (options.operations.hasOwnProperty(key)) return true;
}
return false;
};
Expand Down Expand Up @@ -426,7 +426,7 @@ const createQueryOperations = (
return [selfOperations, nestedOperations];
}
for (const key in query) {
if (options.operations[key]) {
if (options.operations.hasOwnProperty(key)) {
const op = createNamedOperation(key, query[key], query, options);

if (op) {
Expand Down
2 changes: 2 additions & 0 deletions test/basic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ describe(__filename + "#", function() {
});

it("Throws error if operations are mixed with props", () => {
sift({ _id: { $in: [new ObjectID("610b6bc9e29dbd1bb5f045bf")] } });

const test = sift({
_id: { $in: [new ObjectID("610b6bc9e29dbd1bb5f045bf")] }
});
Expand Down

0 comments on commit 028bc73

Please sign in to comment.