From 1842828ec6067206cb33243906ccc6d2b07611db Mon Sep 17 00:00:00 2001 From: David Ashby Date: Tue, 16 May 2017 21:57:29 -0400 Subject: [PATCH] pre-sort by title to take advantange of stable sort; watch for null date --- index.html | 1 + index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 7ecbd7d..829e2ad 100644 --- a/index.html +++ b/index.html @@ -29,6 +29,7 @@ } function renderTable(data, sortField) { + data = _.sortBy(data, 'title'); data = _.sortBy(data, sortField); $.each(data, function(key, value) { diff --git a/index.js b/index.js index ad6c774..818576f 100644 --- a/index.js +++ b/index.js @@ -142,7 +142,7 @@ function normalizeGoogleData(book) { publisher: _.trim(book.publisher, '"'), series: '', volume: '', - publishedDate: book.publishedDate.substring(0, 4), + publishedDate: book.publishedDate ? book.publishedDate.substring(0, 4) : '', coverurl: '', description: book.description, notes: '',