Skip to content

Commit 8720215

Browse files
committed
chore(relation): use filter to avoid undefined values
1 parent f5d216d commit 8720215

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/database",
3-
"version": "5.17.0",
3+
"version": "5.18.0",
44
"description": "The Athenna database handler for SQL/NoSQL.",
55
"license": "MIT",
66
"author": "João Lenon <lenon@athenna.io>",

src/models/relations/BelongsToMany/BelongsToManyRelation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class BelongsToManyRelation {
9999
return models.map(model => {
100100
const ids = pivotDataMap.get(model[relation.primaryKey]) || []
101101

102-
model[relation.property] = ids.map(id => map.get(id))
102+
model[relation.property] = ids.filter(id => map.get(id))
103103

104104
return model
105105
})

0 commit comments

Comments
 (0)