Skip to content

Commit

Permalink
fix logic of sorting (closes #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaorio committed Dec 20, 2022
1 parent 8893559 commit 7bba5b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/img-gallery-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export class imgGalleryRenderer extends MarkdownRenderChild {

// sort the list by name, mtime, or ctime
const orderedImages = images.sort((a: any, b: any) => {
const refA = this._settings.sortby ? a.stat[this._settings.sortby] : a['name'].toUpperCase()
const refB = this._settings.sortby ? b.stat[this._settings.sortby] : b['name'].toUpperCase()
const refA = this._settings.sortby === 'name' ? a['name'].toUpperCase() : a.stat[this._settings.sortby]
const refB = this._settings.sortby === 'name' ? b['name'].toUpperCase() : b.stat[this._settings.sortby]
return (refA < refB) ? -1 : (refA > refB) ? 1 : 0
})

Expand Down

0 comments on commit 7bba5b1

Please sign in to comment.