chore: revise map
This commit is contained in:
parent
cb49bb0ab5
commit
4637a63042
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
}),
|
||||
}
|
||||
|
|
Reference in a new issue