Skip to content

Instantly share code, notes, and snippets.

@thorn
Created May 24, 2012 10:07
Show Gist options
  • Save thorn/2780613 to your computer and use it in GitHub Desktop.
Save thorn/2780613 to your computer and use it in GitHub Desktop.
sorts object by key coffescript
sort_obj_by_key = (obj) ->
sorted = {}
keys = (key for own key, value of obj).sort()
sorted[key] = obj[key] for key in keys
sorted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment