Skip to content

Commit ba7076d

Browse files
committed
feat(relation): remove undefined values
1 parent 8720215 commit ba7076d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/database",
3-
"version": "5.18.0",
3+
"version": "5.19.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

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

102-
model[relation.property] = ids.filter(id => map.get(id))
102+
model[relation.property] = ids
103+
.map(id => map.get(id))
104+
.filter(data => data !== undefined)
103105

104106
return model
105107
})

0 commit comments

Comments
 (0)