Last active
August 29, 2015 14:01
-
-
Save indiejoseph/b3a6da62a1b4647c9a8f to your computer and use it in GitHub Desktop.
Sort object by value
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
| obj = do (obj) -> | |
| res = {} | |
| keys = Object.keys(obj).sort (a, b) -> obj[b] - obj[a] | |
| res[name] = obj[name] for name in keys | |
| res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment