File tree 1 file changed +3
-6
lines changed
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -23,17 +23,14 @@ const results = {
23
23
24
24
// Identify files that should be skipped. As files are processed, they
25
25
// are added to this list to prevent dupes.
26
- const seen = {
27
- 'all.json' : true ,
28
- 'index.json' : true
29
- } ;
26
+ const seen = new Set ( [ 'all.json' , 'index.json' ] ) ;
30
27
31
28
// Extract (and concatenate) the selected data from each document.
32
29
// Expand hrefs found in json to include source HTML file.
33
30
for ( const link of toc . match ( / < a .* ?> / g) ) {
34
31
const href = / h r e f = " ( .* ?) " / . exec ( link ) [ 1 ] ;
35
32
const json = href . replace ( '.html' , '.json' ) ;
36
- if ( ! jsonFiles . includes ( json ) || seen [ json ] ) continue ;
33
+ if ( ! jsonFiles . includes ( json ) || seen . has ( json ) ) continue ;
37
34
const data = JSON . parse (
38
35
fs . readFileSync ( new URL ( `./${ json } ` , source ) , 'utf8' )
39
36
. replace ( / < a h r e f = \\ " # / g, `<a href=\\"${ href } #` )
@@ -49,7 +46,7 @@ for (const link of toc.match(/<a.*?>/g)) {
49
46
}
50
47
51
48
// Mark source as seen.
52
- seen [ json ] = true ;
49
+ seen . add ( json ) ;
53
50
}
54
51
55
52
// Write results.
You can’t perform that action at this time.
0 commit comments