Skip to content

Commit

Permalink
Address CodeQL scan warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Castro, Mario committed Sep 27, 2024
1 parent 5599ddd commit c4a9e04
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class ReadModelRegistry {
toLocalSortFor(
sortBy?: SortFor<unknown>,
parentKey = '',
sortedList: LocalSortedFor = {}
sortedList: LocalSortedFor = Object.create(null)
): undefined | LocalSortedFor {
if (!sortBy || Object.keys(sortBy).length === 0) return
const elements = sortBy!
Expand All @@ -120,7 +120,7 @@ export class ReadModelRegistry {
}

filterFields(obj: any, select: string[]): any {
const result: any = {}
const result: any = Object.create(null)

select.forEach((field) => {
const parts = field.split('.')
Expand Down Expand Up @@ -151,7 +151,7 @@ export class ReadModelRegistry {
} else {
currentSource[arrayField].forEach((item: any, index: number) => {
if (!currentResult[arrayField][index]) {
currentResult[arrayField][index] = {}
currentResult[arrayField][index] = Object.create(null)
}
this.setNestedValue(currentResult[arrayField][index], item, parts.slice(i + 1))
})
Expand All @@ -166,7 +166,7 @@ export class ReadModelRegistry {
return
}
if (!currentResult[part]) {
currentResult[part] = Array.isArray(currentSource[part]) ? [] : {}
currentResult[part] = Array.isArray(currentSource[part]) ? [] : Object.create(null)
}
currentResult = currentResult[part]
currentSource = currentSource[part]
Expand Down

0 comments on commit c4a9e04

Please sign in to comment.