index.js
function fileSort(a, b) {
  return Number(b.stat && b.stat.isDirectory()) - Number(a.stat && a.stat.isDirectory()) ||
    String(a.name).toLocaleLowerCase().localeCompare(String(b.name).toLocaleLowerCase());
}
function fileSort(a, b) {
  return Number(b.stat && b.stat.isDirectory()) - Number(a.stat && a.stat.isDirectory()) ||
    String(a.name).toLocaleLowerCase().localeCompare(String(b.name).toLocaleLowerCase());
}
function fileSort ( a , b ) { return Number ( b . stat && b . stat . isDirectory ( ) ) - Number ( a . stat && a . stat . isDirectory ( ) ) || String ( a . name ) . toLocaleLowerCase ( ) . localeCompare ( String ( b . name ) . toLocaleLowerCase ( ) ) ; }
Sort function for with directories first.
Sort function for with directories first .