Skip to content

Commit

Permalink
Fix an issue with file ordering in reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Nov 14, 2016
1 parent 8f6330c commit 5854b49
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@ export function list (path: string, options: ListOptions = {}): Promise<string[]
}

return readdir(path)
// Reverse the list.
.then(files => {
return options.reverse ? files.reverse() : files
})
// Filter by name and supported extensions.
.then(files => {
if (options.name) {
Expand All @@ -302,6 +298,10 @@ export function list (path: string, options: ListOptions = {}): Promise<string[]

return files.filter(filename => extensions.indexOf(extname(filename)) > -1).sort()
})
// Reverse the list.
.then(files => {
return options.reverse ? files.reverse() : files
})
// Support "begin" option.
.then(files => {
if (options.begin) {
Expand Down

0 comments on commit 5854b49

Please sign in to comment.