Skip to content

Tankōbon / lib/library-sort / sortEntries

Function: sortEntries() ​

sortEntries(entries, sort): LibraryEntry[]

Defined in: lib/library-sort.ts:17

The entries in the requested order, as a new array. lastOpened keeps the given order (the store's lastOpenedAt DESC). Dates compare as strings: the ISO timestamps of addedAt and the YYYY/YYYY-MM/YYYY-MM-DD of releaseDate, where a shorter date sorts before the longer ones of the same period. Books without a release date come last in both directions. Titles compare in natural order ("Tome 2" before "Tome 10"), ignoring case and accents; equal keys fall back to the title, then keep the given order.

Parameters ​

entries ​

readonly LibraryEntry[]

sort ​

"lastOpened" | "addedDesc" | "addedAsc" | "releaseDesc" | "releaseAsc" | "titleAsc" | "titleDesc"

Returns ​

LibraryEntry[]