From d591cdad2bf03ae4e20023b47add1ebe32d80e48 Mon Sep 17 00:00:00 2001 From: Jari Bakken Date: Fri, 14 Nov 2014 16:40:13 +0100 Subject: [PATCH] Use knex' map() --- lib/eventDb.js | 8 ++------ lib/featureDb.js | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/eventDb.js b/lib/eventDb.js index 8a1661b2b8..f340cf0327 100644 --- a/lib/eventDb.js +++ b/lib/eventDb.js @@ -14,9 +14,7 @@ function getEvents() { .select(EVENT_COLUMNS) .from('events') .orderBy('created_at', 'desc') - .then(function (rows) { - return rows.map(rowToEvent); - }); + .map(rowToEvent); } function getEventsFilterByName(name) { @@ -25,9 +23,7 @@ function getEventsFilterByName(name) { .from('events') .whereRaw("data ->> 'name' = ?", [name]) .orderBy('created_at', 'desc') - .then(function (rows) { - return rows.map(rowToEvent); - }); + .map(rowToEvent); } function rowToEvent(row) { diff --git a/lib/featureDb.js b/lib/featureDb.js index 18d29b0f6f..0141047ee7 100644 --- a/lib/featureDb.js +++ b/lib/featureDb.js @@ -26,9 +26,7 @@ function getFeatures() { .select(FEATURE_COLUMNS) .from('features') .orderBy('created_at', 'desc') - .then(function (rows) { - return rows.map(rowToFeature); - }); + .map(rowToFeature); } function getFeature(name) {