From fd991668af2a0d9470a794854d2c1dde846d0405 Mon Sep 17 00:00:00 2001 From: Jonathan Cremin Date: Thu, 4 Dec 2014 19:30:29 +0000 Subject: [PATCH] Sort results with no matches last --- routes/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routes/index.js b/routes/index.js index e5b8ab3..5681c06 100644 --- a/routes/index.js +++ b/routes/index.js @@ -35,6 +35,11 @@ router.get('/:service/:type/:id', function(req, res) { return result.value; } }); + + items.sort(function(a, b) { + return !a.id || !b.id; + }) + items.unshift(item); res.render(type, {items: items});