From 83230afa51fd1ec6a1e224baeac59bd4be4eb0d4 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 29 Jan 2015 19:46:38 -0500 Subject: js: Clean up packageCount function. * js/utils.js (guix.add): New function. * js/controllers/packages.js (guix.packages.controller.packageCount): Reimplement. --- js/controller/packages.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'js/controller') diff --git a/js/controller/packages.js b/js/controller/packages.js index 89f01e9..d9e0839 100644 --- a/js/controller/packages.js +++ b/js/controller/packages.js @@ -61,9 +61,10 @@ }; controller.prototype.packageCount = function() { - return this.pager().pages.reduce(function(memo, page) { - return memo + page.length; - }, 0); + return _.chain(this.pager().pages) + .pluck('length') + .reduce(guix.add, 0) + .value(); }; controller.prototype.doSearch = function() { -- cgit v1.2.3