chore: ranks instead of plays
This commit is contained in:
parent
be0c6396ad
commit
d2c8b99b62
2 changed files with 3 additions and 3 deletions
|
@ -37,5 +37,5 @@ 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),
|
||||
sortByPlays: (array) => Object.values(array).sort((a, b) => b.plays - a.plays).map((media, index) => media.rank = index + 1),
|
||||
}
|
||||
|
|
Reference in a new issue