Example #1
0
 return (a, b) => {
   if (a.type !== b.type) {
     return isDirectory(a) ? -1 : 1
   }
   return sort.order === 'desc'
     ? b.name.localeCompare(a.name)
     : a.name.localeCompare(b.name)
 }
Example #2
0
export const getFilePath = ({ view }, file) => {
  const { displayedFolder } = view
  if (isDirectory(file)) {
    return file.path
  } else {
    const folderPath = displayedFolder
      ? !isRootFolder(displayedFolder)
        ? displayedFolder.path
        : ''
      : file.path // file.path is the parent folder path
    return `${folderPath}/${file.name}`
  }
}