From 8d92c03a4a092f7dcd23b05060b313487738339f Mon Sep 17 00:00:00 2001 From: Eduard Castellano Date: Wed, 27 Nov 2019 21:24:30 +0900 Subject: [PATCH] Fix the return value in the sort() function to follow the standard --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4f1e664..90c002a 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ module.exports = function() { return false; } }); - itemsFiltered.sort(function(a, b) { return a[Object.keys(a)[0]] < b[Object.keys(b)[0]]; }); + itemsFiltered.sort(function(a, b) { return a[Object.keys(a)[0]] < b[Object.keys(b)[0]] ? 1 : -1 }); for(item in itemsFiltered) { if(itemsFiltered.hasOwnProperty(item)) {