const findMatch = ( path , folders , files ) : string | undefined => { const foundFile = files . find ( ( file ) => file === path ) ; if ( foundFile ) { return foundFile ; } for ( const folder of folders ) { const formattedFolder = folder . substring ( 0 , folder . length - 1 ) ; if ( path . includes ( formattedFolder ) ) { return folder ; } } } ; const isExcludedExtn = ( fileExtension , excludeExtensions ) : boolean => excludeExtensions . some ( ( toIgnoreExtension ) => toIgnoreExtension === fileExtension ) ; const isReservedPage = ( pageName ) : boolean => pageName . charAt ( 0 ) === '_' || pageName . charAt ( 0 ) === '.' ; const splitFilenameAndExtn = ( filename ) : string [ ] => { const dotIndex = filename . lastIndexOf ( '.' ) ; return [ filename . substring ( 0 , dotIndex ) , filename . substring ( dotIndex + 1 , filename . length ) , ] ; } ; const splitFoldersAndFiles = ( data ) : string [ ] [ ] => { const folders = [ ] ; const files = data . filter ( ( item ) => { if ( item . charAt ( item . length - 1 ) === '*' ) { folders . push ( item ) ; return false ; } return true ; } ) ; return [ folders , files ] ; } ; export { findMatch , isExcludedExtn , isReservedPage , splitFilenameAndExtn , splitFoldersAndFiles , } ;