Skip to content

Commit

Permalink
fix: $pull continue if key does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Jul 5, 2024
1 parent e53b1ba commit 41f44a0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@
if (!exists)
newObject[keys[i]].push(value)
} else if (operator === '$pull') {
if (!newObject[keys[i]])
continue
if (Array.isArray(value)) {
newObject[keys[i]] = newObject[keys[i]].filter(item => !Array.isArray(item) || !isEqualArray(item, value));
} else if (typeof value === 'object' && value !== null) {
Expand Down

0 comments on commit 41f44a0

Please sign in to comment.