Skip to content

Commit

Permalink
Enable stems to be globs
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Apr 26, 2024
1 parent bc348eb commit 8c8efdf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bids-validator/src/deps/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ export {
parse,
SEPARATOR,
} from 'https://deno.land/[email protected]/path/mod.ts'
export {
globToRegExp,
} from 'https://deno.land/[email protected]/path/glob_to_regexp.ts'
4 changes: 2 additions & 2 deletions bids-validator/src/validators/filenameIdentify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* object in the schema for reference.
*/
// @ts-nocheck
import { SEPARATOR } from '../deps/path.ts'
import { SEPARATOR, globToRegExp } from '../deps/path.ts'
import { GenericSchema, Schema } from '../types/schema.ts'
import { BIDSContext } from '../schema/context.ts'
import { lookupModality } from '../schema/modalities.ts'
Expand Down Expand Up @@ -56,7 +56,7 @@ function findRuleMatches(schema, context) {
export function _findRuleMatches(node, path, context) {
if (
('path' in node && context.file.name.endsWith(node.path)) ||
('stem' in node && context.file.name.startsWith(node.stem)) ||
('stem' in node && context.file.name.match(globToRegExp(node.stem + '*'))) ||
('suffixes' in node && node.suffixes.includes(context.suffix))
) {
context.filenameRules.push(path)
Expand Down

0 comments on commit 8c8efdf

Please sign in to comment.