Skip to content

Commit

Permalink
Add documentation for new functions
Browse files Browse the repository at this point in the history
  • Loading branch information
happy5214 committed Oct 19, 2023
1 parent 5382cff commit f5e6bd1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bids/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ function validateSidecars(sidecarData, hedSchemas) {
return [sidecarErrorsFound, issues]
}

/**
* Validate an individual BIDS sidecar.
*
* @param {BidsSidecar} sidecar A BIDS sidecar.
* @param {Schemas} hedSchemas A HED schema collection.
* @returns {BidsHedIssue[]} All issues found.
*/
function validateSidecar(sidecar, hedSchemas) {
const issues = []
for (const [sidecarKey, hedData] of sidecar.parsedHedData) {
Expand All @@ -110,6 +117,16 @@ function validateSidecar(sidecar, hedSchemas) {
return issues
}

/**
* Validate an individual BIDS sidecar string.
*
* @param {string} sidecarKey The sidecar key this string belongs to.
* @param {ParsedHedString} sidecarString The parsed sidecar HED string.
* @param {BidsSidecar} sidecar The BIDS sidecar.
* @param {Object} options Options specific to this validation run to pass to {@link validateHedString}.
* @param {Schemas} hedSchemas The HED schema collection to validate against.
* @returns {BidsHedIssue[]} All issues found.
*/
function validateSidecarString(sidecarKey, sidecarString, sidecar, options, hedSchemas) {
const [, hedIssues] = validateHedString(sidecarString, hedSchemas, options)
return convertHedIssuesToBidsIssues(hedIssues, sidecar.file, { sidecarKey })
Expand Down

0 comments on commit f5e6bd1

Please sign in to comment.