Skip to content

Commit

Permalink
fix: avoid Maximum call stack size exceeded
Browse files Browse the repository at this point in the history
Using spread syntax `...SomeIterable` with a long list inside a
function call can result in a "Maximum call stack size exceeded"
error. But this is not a problem inside array literals.
  • Loading branch information
mguaypaq authored and effigies committed Oct 16, 2024
1 parent 35306a2 commit 4671868
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions bids-validator/validators/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ import isNode from '../utils/isNode'
* files from the set.
*/
const session = function missingSessionFiles(fileList) {
const issues = []
const { subjects, sessions } = getDataOrganization(fileList)

issues.push(...missingSessionWarnings(subjects, sessions))

const subject_files = getSubjectFiles(subjects)
issues.push(...missingFileWarnings(subjects, subject_files))

return issues
return [
...missingSessionWarnings(subjects, sessions),
...missingFileWarnings(subjects, subject_files),
]
}

/**
Expand Down

0 comments on commit 4671868

Please sign in to comment.