Skip to content

Commit

Permalink
Replace BidsTsvFile subclass distinction with new property on parent …
Browse files Browse the repository at this point in the history
…class
  • Loading branch information
happy5214 committed Jan 5, 2024
1 parent c5d763d commit 72d4ac5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 15 additions & 4 deletions bids/types/tsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,33 @@ export class BidsTsvFile extends BidsFile {
/**
* Determine whether this file has any HED data.
*
* @todo To be replaced with property in version 4.0.0.
*
* @returns {boolean}
*/
hasHedData() {
return this.parsedTsv.has('HED')
}

/**
* Whether this TSV file is a timeline file.
*
* @returns {boolean}
*/
get isTimelineFile() {
return this.parsedTsv.has('onset')
}
}

/**
* A BIDS events.tsv file.
*
* @deprecated Use {@link BidsTsvFile}. Will be removed in version 4.0.0.
*/
export class BidsEventFile extends BidsTsvFile {
/**
* Constructor.
*
* @todo This interface is subject to modification in version 4.0.0.
*
* @param {string} name The name of the event TSV file.
* @param {string[]} potentialSidecars The list of potential JSON sidecars.
* @param {object} mergedDictionary The merged sidecar data.
Expand All @@ -102,13 +113,13 @@ export class BidsEventFile extends BidsTsvFile {

/**
* A BIDS TSV file other than an events.tsv file.
*
* @deprecated Use {@link BidsTsvFile}. Will be removed in version 4.0.0.
*/
export class BidsTabularFile extends BidsTsvFile {
/**
* Constructor.
*
* @todo This interface is subject to modification in version 4.0.0.
*
* @param {string} name The name of the TSV file.
* @param {string[]} potentialSidecars The list of potential JSON sidecars.
* @param {object} mergedDictionary The merged sidecar data.
Expand Down
2 changes: 1 addition & 1 deletion bids/validator/bidsHedTsvValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class BidsHedTsvValidator {
this.hedSchemas,
{
checkForWarnings: true,
validateDatasetLevel: this.tsvFile instanceof BidsEventFile,
validateDatasetLevel: this.tsvFile.isTimelineFile,
},
)
this.issues.push(...BidsHedIssue.fromHedIssues(hedIssues, this.tsvFile.file))
Expand Down

0 comments on commit 72d4ac5

Please sign in to comment.