[cleanup] refactor OpenLib sort into getOpenLibResult

This commit is contained in:
mikiher 2023-09-30 18:08:03 +00:00
parent f0929729a3
commit 1d3ad38187

View File

@ -136,6 +136,10 @@ class BookFinder {
if (!booksFiltered.length && books.length) { if (!booksFiltered.length && books.length) {
if (this.verbose) Logger.debug(`Search has ${books.length} matches, but no close title matches`) if (this.verbose) Logger.debug(`Search has ${books.length} matches, but no close title matches`)
} }
booksFiltered.sort((a, b) => {
return a.totalDistance - b.totalDistance
})
return booksFiltered return booksFiltered
} }
@ -282,12 +286,6 @@ class BookFinder {
} }
} }
if (provider === 'openlibrary') {
books.sort((a, b) => {
return a.totalDistance - b.totalDistance
})
}
return books return books
} }