Sort files at end of directory tree

This commit is contained in:
John Furrow
2016-05-22 21:09:57 -07:00
parent 9398772795
commit 15130809f8

View File

@@ -19,7 +19,19 @@ export default class DirectoryTree extends React.Component {
let hash = this.props.hash;
depth++;
return Object.keys(tree).map((branchName) => {
let directories = Object.keys(tree).sort((a, b) => {
if (a === 'files') {
return 1;
}
if (b === 'files') {
return -1;
}
return a.localeCompare(b);
});
return directories.map((branchName) => {
let branch = tree[branchName];
index++;