This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm install [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sortMapByValue(map) { | |
| var tupleArray = []; | |
| for (var key in map) tupleArray.push([key, map[key]]); | |
| tupleArray.sort(function (a, b) { | |
| return b[1] - a[1] | |
| }); | |
| var sortedMap = {}; | |
| tupleArray.forEach(function (el) { | |
| sortedMap[el[0]] = el[1] | |
| }); |