@@ -8,63 +8,67 @@ var Issue = utils.issues.Issue
88 * directories. Then generates a warning if a given subject is missing any
99 * files from the set.
1010 */
11- var session = function missingSessionFiles ( fileList ) {
12- var subjects = { }
13- var issues = [ ]
14- for ( var key in fileList ) {
15- var file = fileList [ key ]
16- var filename
11+ const session = function missingSessionFiles ( fileList ) {
12+ const subjects = { }
13+ const issues = [ ]
14+ for ( let key in fileList ) {
15+ if ( fileList . hasOwnProperty ( key ) ) {
16+ const file = fileList [ key ]
17+ let filename
1718
18- if ( ! file || ( typeof window != 'undefined' && ! file . webkitRelativePath ) ) {
19- continue
20- }
19+ if ( ! file || ( typeof window != 'undefined' && ! file . webkitRelativePath ) ) {
20+ continue
21+ }
2122
22- var path = file . relativePath
23- if ( ! utils . type . isBIDS ( path ) || utils . type . file . isStimuliData ( path ) ) {
24- continue
25- }
26- var subject
27- //match the subject identifier up to the '/' in the full path to a file.
28- var match = path . match ( / s u b - ( .* ?) (? = \/ ) / )
29- if ( match === null ) {
30- continue
31- } else {
32- subject = match [ 0 ]
33- }
23+ const path = file . relativePath
24+ if ( ! utils . type . isBIDS ( path ) || utils . type . file . isStimuliData ( path ) ) {
25+ continue
26+ }
27+ let subject
28+ //match the subject identifier up to the '/' in the full path to a file.
29+ const match = path . match ( / s u b - ( .* ?) (? = \/ ) / )
30+ if ( match === null ) {
31+ continue
32+ } else {
33+ subject = match [ 0 ]
34+ }
3435
35- // suppress inconsistent subject warnings for sub-emptyroom scans
36- // in MEG data
37- if ( subject == 'sub-emptyroom' ) {
38- continue
39- }
36+ // suppress inconsistent subject warnings for sub-emptyroom scans
37+ // in MEG data
38+ if ( subject == 'sub-emptyroom' ) {
39+ continue
40+ }
4041
41- // initialize an empty array if we haven't seen this subject before
42- if ( typeof subjects [ subject ] === 'undefined' ) {
43- subjects [ subject ] = [ ]
42+ // initialize an empty array if we haven't seen this subject before
43+ if ( typeof subjects [ subject ] === 'undefined' ) {
44+ subjects [ subject ] = [ ]
45+ }
46+ // files are prepended with subject name, the following two commands
47+ // remove the subject from the file name to allow filenames to be more
48+ // easily compared
49+ filename = path . substring ( path . match ( subject ) . index + subject . length )
50+ filename = filename . replace ( subject , '<sub>' )
51+ subjects [ subject ] . push ( filename )
4452 }
45- // files are prepended with subject name, the following two commands
46- // remove the subject from the file name to allow filenames to be more
47- // easily compared
48- filename = path . substring ( path . match ( subject ) . index + subject . length )
49- filename = filename . replace ( subject , '<sub>' )
50- subjects [ subject ] . push ( filename )
5153 }
5254
53- var subject_files = [ ]
55+ const subject_files = [ ]
5456
55- for ( var subjKey in subjects ) {
56- subject = subjects [ subjKey ]
57- for ( var i = 0 ; i < subject . length ; i ++ ) {
58- file = subject [ i ]
59- if ( subject_files . indexOf ( file ) < 0 ) {
60- subject_files . push ( file )
57+ for ( let subjKey in subjects ) {
58+ if ( subjects . hasOwnProperty ( subjKey ) ) {
59+ const subject = subjects [ subjKey ]
60+ for ( var i = 0 ; i < subject . length ; i ++ ) {
61+ const file = subject [ i ]
62+ if ( subject_files . indexOf ( file ) < 0 ) {
63+ subject_files . push ( file )
64+ }
6165 }
6266 }
6367 }
6468
6569 var subjectKeys = Object . keys ( subjects ) . sort ( )
6670 for ( var j = 0 ; j < subjectKeys . length ; j ++ ) {
67- subject = subjectKeys [ j ]
71+ const subject = subjectKeys [ j ]
6872 for ( var set_file = 0 ; set_file < subject_files . length ; set_file ++ ) {
6973 if ( subjects [ subject ] . indexOf ( subject_files [ set_file ] ) === - 1 ) {
7074 var fileThatsMissing =
0 commit comments