File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -23,17 +23,14 @@ const results = {
2323
2424// Identify files that should be skipped. As files are processed, they
2525// 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' ] ) ;
3027
3128// Extract (and concatenate) the selected data from each document.
3229// Expand hrefs found in json to include source HTML file.
3330for ( const link of toc . match ( / < a .* ?> / g) ) {
3431 const href = / h r e f = " ( .* ?) " / . exec ( link ) [ 1 ] ;
3532 const json = href . replace ( '.html' , '.json' ) ;
36- if ( ! jsonFiles . includes ( json ) || seen [ json ] ) continue ;
33+ if ( ! jsonFiles . includes ( json ) || seen . has ( json ) ) continue ;
3734 const data = JSON . parse (
3835 fs . readFileSync ( new URL ( `./${ json } ` , source ) , 'utf8' )
3936 . replace ( / < a h r e f = \\ " # / g, `<a href=\\"${ href } #` )
@@ -49,7 +46,7 @@ for (const link of toc.match(/<a.*?>/g)) {
4946 }
5047
5148 // Mark source as seen.
52- seen [ json ] = true ;
49+ seen . add ( json ) ;
5350}
5451
5552// Write results.
You can’t perform that action at this time.
0 commit comments