Skip to content

Commit

Permalink
Removed the unused validator code
Browse files Browse the repository at this point in the history
  • Loading branch information
VisLab committed Dec 23, 2024
1 parent dcee6f0 commit 3dd3a15
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 904 deletions.
6 changes: 2 additions & 4 deletions bids/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import buildBidsSchemas from './schema'
import { buildBidsSchemas } from './schema'
import validateBidsDataset from './validate'
import { BidsJsonFile, BidsSidecar } from './types/json'
import { BidsTabularFile, BidsTsvFile } from './types/tsv'
import { BidsTsvFile } from './types/tsv'
import BidsDataset from './types/dataset'
import { BidsHedIssue, BidsIssue } from './types/issues'
import BidsHedSidecarValidator from './validator/sidecarValidator'
Expand All @@ -10,7 +10,6 @@ import BidsHedTsvValidator from './validator/tsvValidator'
export {
BidsDataset,
BidsTsvFile,
BidsTabularFile,
BidsJsonFile,
BidsSidecar,
BidsIssue,
Expand All @@ -24,7 +23,6 @@ export {
export default {
BidsDataset,
BidsTsvFile,
BidsTabularFile,
BidsJsonFile,
BidsSidecar,
BidsIssue,
Expand Down
2 changes: 1 addition & 1 deletion bids/types/dataset.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export class BidsDataset {
/**
* The dataset's event file data.
* @type {BidsEventFile[]}
* @type {BidsTsvFile[]}
*/
eventData
/**
Expand Down
32 changes: 16 additions & 16 deletions utils/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ export function recursiveMap(fn, array) {
}
}

/**
* Apply a function recursively to an array.
*
* @template T,U
* @param {function(T, U[]): U} fn The function to apply.
* @param {T[]} array The array to map.
* @param {U[]} [issues] An optional array to collect issues.
* @returns {U[]} The mapped array.
*/
export function recursiveMapNew(fn, array, issues = []) {
if (Array.isArray(array)) {
return array.map((element) => recursiveMap(fn, element, issues))
} else {
return fn(array, issues)
}
}
// /**
// * Apply a function recursively to an array.
// *
// * @template T,U
// * @param {function(T, U[]): U} fn The function to apply.
// * @param {T[]} array The array to map.
// * @param {U[]} [issues] An optional array to collect issues.
// * @returns {U[]} The mapped array.
// */
// export function recursiveMapNew(fn, array, issues = []) {
// if (Array.isArray(array)) {
// return array.map((element) => recursiveMap(fn, element, issues))
// } else {
// return fn(array, issues)
// }
// }
60 changes: 30 additions & 30 deletions utils/hedData.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import lt from 'semver/functions/lt'

import ParsedHedTag from '../parser/parsedHedTag'
import { TagSpec } from '../parser/tokenizer'
//
// import ParsedHedTag from '../parser/parsedHedTag'
// import { TagSpec } from '../parser/tokenizer'

/**
* Determine the HED generation for a base schema version number.
Expand All @@ -19,31 +19,31 @@ export const getGenerationForSchemaVersion = function (version) {
}
}

export const mergeParsingIssues = function (previousIssues, currentIssues) {
for (const [key, currentIssue] of Object.entries(currentIssues)) {
previousIssues[key] = previousIssues[key] !== undefined ? previousIssues[key].concat(currentIssue) : currentIssue
}
}
// export const mergeParsingIssues = function (previousIssues, currentIssues) {
// for (const [key, currentIssue] of Object.entries(currentIssues)) {
// previousIssues[key] = previousIssues[key] !== undefined ? previousIssues[key].concat(currentIssue) : currentIssue
// }
// }

/**
* Get the parent tag objects for a given short tag.
*
* @param {Schemas} hedSchemas The HED schema collection.
* @param {string} shortTag A short-form HED 3 tag.
* @returns {Map<Schema, ParsedHedTag>} A Map mapping a {@link Schema} to a {@link ParsedHedTag} object representing the full tag.
*/
export const getParsedParentTags = function (hedSchemas, shortTag) {
const parentTags = new Map()
for (const [schemaNickname, schema] of hedSchemas.schemas) {
try {
const parentTag = new ParsedHedTag(
new TagSpec(shortTag, 0, shortTag.length - 1, schemaNickname),
hedSchemas,
shortTag,
)
parentTags.set(schema, parentTag)
// eslint-disable-next-line no-empty
} catch (e) {}
}
return parentTags
}
// /**
// * Get the parent tag objects for a given short tag.
// *
// * @param {Schemas} hedSchemas The HED schema collection.
// * @param {string} shortTag A short-form HED 3 tag.
// * @returns {Map<Schema, ParsedHedTag>} A Map mapping a {@link Schema} to a {@link ParsedHedTag} object representing the full tag.
// */
// export const getParsedParentTags = function (hedSchemas, shortTag) {
// const parentTags = new Map()
// for (const [schemaNickname, schema] of hedSchemas.schemas) {
// try {
// const parentTag = new ParsedHedTag(
// new TagSpec(shortTag, 0, shortTag.length - 1, schemaNickname),
// hedSchemas,
// shortTag,
// )
// parentTags.set(schema, parentTag)
// // eslint-disable-next-line no-empty
// } catch (e) {}
// }
// return parentTags
// }
20 changes: 10 additions & 10 deletions utils/hedStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ export const getTagSlashIndices = function (tag) {
return indices
}

/**
* Get the levels of a tag.
*
* @param {string} tag A HED tag string.
* @returns {string[]} The levels of this tag.
*/
export const getTagLevels = function (tag) {
const tagSlashIndices = getTagSlashIndices(tag)
return tagSlashIndices.map((tagSlashIndex) => tag.slice(0, tagSlashIndex))
}
// /**
// * Get the levels of a tag.
// *
// * @param {string} tag A HED tag string.
// * @returns {string[]} The levels of this tag.
// */
// export const getTagLevels = function (tag) {
// const tagSlashIndices = getTagSlashIndices(tag)
// return tagSlashIndices.map((tagSlashIndex) => tag.slice(0, tagSlashIndex))
// }

/**
* Get the last part of a HED tag.
Expand Down
42 changes: 21 additions & 21 deletions utils/map.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import identity from 'lodash/identity'
// import identity from 'lodash/identity'
import isEqual from 'lodash/isEqual'

/**
Expand Down Expand Up @@ -29,23 +29,23 @@ export const filterNonEqualDuplicates = function (list, equalityFunction = isEqu
return [map, duplicates]
}

/**
* Group a list by a given grouping function.
*
* @template T, U
* @param {T[]} list The list to group.
* @param {function (T): U} groupingFunction A function mapping a list value to the key it is to be grouped under.
* @returns {Map<U, T[]>} The grouped map.
*/
export const groupBy = function (list, groupingFunction = identity) {
const groupingMap = new Map()
for (const listEntry of list) {
const groupingValue = groupingFunction(listEntry)
if (groupingMap.has(groupingValue)) {
groupingMap.get(groupingValue).push(listEntry)
} else {
groupingMap.set(groupingValue, [listEntry])
}
}
return groupingMap
}
// /**
// * Group a list by a given grouping function.
// *
// * @template T, U
// * @param {T[]} list The list to group.
// * @param {function (T): U} groupingFunction A function mapping a list value to the key it is to be grouped under.
// * @returns {Map<U, T[]>} The grouped map.
// */
// export const groupBy = function (list, groupingFunction = identity) {
// const groupingMap = new Map()
// for (const listEntry of list) {
// const groupingValue = groupingFunction(listEntry)
// if (groupingMap.has(groupingValue)) {
// groupingMap.get(groupingValue).push(listEntry)
// } else {
// groupingMap.set(groupingValue, [listEntry])
// }
// }
// return groupingMap
// }
Loading

0 comments on commit 3dd3a15

Please sign in to comment.