File tree 1 file changed +10
-11
lines changed
1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/env node
2
-
3
1
const path = require ( 'path' ) ;
4
- const fs = require ( 'fs' ) ;
5
2
const htmlDiffer = require ( './helpers/html-differ.js' ) ;
3
+ const { loadFiles} = require ( './helpers/load.js' ) ;
6
4
7
5
let marked = require ( '../' ) ;
8
6
9
7
function load ( ) {
10
- const folder = path . resolve ( __dirname , './specs/commonmark' ) ;
11
- const files = fs . readdirSync ( folder ) ;
12
- return files . reduce ( ( arr , file ) => {
13
- if ( file . match ( / \. j s o n $ / ) ) {
14
- return arr . concat ( require ( `${ folder } /${ file } ` ) ) ;
15
- }
16
- return arr ;
17
- } , [ ] ) ;
8
+ const dir = path . resolve ( __dirname , './specs/commonmark' ) ;
9
+ const sections = loadFiles ( dir ) ;
10
+ let specs = [ ] ;
11
+
12
+ for ( const section in sections ) {
13
+ specs = specs . concat ( sections [ section ] . specs ) ;
14
+ }
15
+
16
+ return specs ;
18
17
}
19
18
20
19
function runBench ( options ) {
You can’t perform that action at this time.
0 commit comments