const isFolder = ( node ) => node . type === 'tree' ; const isNotFolder = ( node ) => node . type !== 'tree' ; export function sortFoldersToFront ( root ) { const nodes = root . contents ; if ( nodes ) { nodes . splice ( 0 , Infinity , ... nodes . filter ( isFolder ) , ... nodes . filter ( isNotFolder ) ) ; nodes . forEach ( sortFoldersToFront ) ; } } export function findGitModules ( root ) { if ( root . contents ) { const modulesFile = root . contents . find ( content => content . name === '.gitmodules' ) ; if ( modulesFile ) { return modulesFile ; } } return null ; }