File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ interface GetDocument {
3030 document : string ;
3131}
3232
33+ const normalizePath = ( path : string ) : string => {
34+ return path . replace ( / \\ / g, "/" ) ;
35+ } ;
36+
3337const allDocs = allDocsArray . filter (
3438 ( doc , index , self ) =>
3539 index ===
@@ -39,9 +43,9 @@ const allDocs = allDocsArray.filter(
3943) ;
4044
4145const getDocument = ( { folder, document } : GetDocument ) : Doc | undefined => {
42- const normalizedDocument = document . replace ( / \\ / g , "/" ) ;
46+ const normalizedDocument = normalizePath ( document ) ;
4347 const doc = allDocs . find ( ( doc ) => {
44- const normalizedPath = doc . _meta . path . replace ( / \\ / g , "/" ) ;
48+ const normalizedPath = normalizePath ( doc . _meta . path ) ;
4549 return doc . folder === folder && normalizedPath === normalizedDocument ;
4650 } ) ;
4751 if ( ! doc ) {
@@ -76,4 +80,10 @@ const getGeneralDocument = (document: string): Doc | undefined => {
7680 return { ...doc , tableOfContents } ;
7781} ;
7882
79- export { getDocument , getDocsByFolder , getGeneralDocument } ;
83+ export {
84+ allDocs ,
85+ normalizePath ,
86+ getDocument ,
87+ getDocsByFolder ,
88+ getGeneralDocument ,
89+ } ;
You can’t perform that action at this time.
0 commit comments