From 4637a630426750c8b86900b704799d495ff0069b Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sat, 21 Oct 2023 13:37:58 -0700 Subject: [PATCH] chore: revise map --- src/utils/media.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/media.js b/src/utils/media.js index adf2a237..d0de47b9 100644 --- a/src/utils/media.js +++ b/src/utils/media.js @@ -37,5 +37,8 @@ module.exports = { * @param {Array} array - an array of media objects. * @returns {Array} - a new array sorted by the number of plays in descending order. */ - sortByPlays: (array) => Object.values(array).sort((a, b) => b.plays - a.plays).map((media, index) => media.rank = index + 1), + sortByPlays: (array) => Object.values(array).sort((a, b) => b.plays - a.plays).map((media, index) => { + media.rank = index + 1 + return media + }), }