diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-01-29 19:46:38 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-01-30 07:27:13 -0500 |
commit | 83230afa51fd1ec6a1e224baeac59bd4be4eb0d4 (patch) | |
tree | 7a8dbfecb488a3846c47374a849379c8d7aba1dc /js/controller | |
parent | 4f13f9d0cefb7abedcca87a52a021356288594e5 (diff) |
js: Clean up packageCount function.
* js/utils.js (guix.add): New function.
* js/controllers/packages.js (guix.packages.controller.packageCount):
Reimplement.
Diffstat (limited to 'js/controller')
-rw-r--r-- | js/controller/packages.js | 7 |
1 files changed, 4 insertions, 3 deletions
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() { |