File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
const fs = require ( 'fs' ) ;
2
- const { join } = require ( 'path' ) ;
2
+ const { join, sep } = require ( 'path' ) ;
3
3
4
4
function getDetails ( data ) {
5
5
const matadata = data . match ( / - - - ( .* \n ) * - - - / ) [ 0 ] ;
@@ -27,15 +27,15 @@ function getFolders(source) {
27
27
const edges = allContent . filter ( isFile ) . map ( file => {
28
28
const data = fs . readFileSync ( file , 'utf-8' ) ;
29
29
return {
30
- id : file . substr ( file . lastIndexOf ( '/' ) + 1 ) ,
30
+ id : file . substr ( file . lastIndexOf ( sep ) + 1 ) ,
31
31
path : file ,
32
32
details : getDetails ( data ) ,
33
33
preview : getPreview ( data )
34
34
} ;
35
35
} ) ;
36
36
const nodes = allContent . filter ( isDirectory ) . map ( dir => getFolders ( dir ) ) ;
37
37
const result = {
38
- id : source . substr ( source . lastIndexOf ( '/' ) + 1 )
38
+ id : source . substr ( source . lastIndexOf ( sep ) + 1 )
39
39
} ;
40
40
if ( nodes . length ) {
41
41
result . nodes = nodes ;
You can’t perform that action at this time.
0 commit comments