Created
February 15, 2015 19:47
-
-
Save vu3jej/477293918a58fa94dc25 to your computer and use it in GitHub Desktop.
JS snippet to transform Kimonolabs JSON endpoints. Demo for http://jithe.sh/ post.
This file contains 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
function transform(data) { | |
// Sort according to location | |
for(var collection in data.results) { | |
data.results[collection].sort(function(a, b) { | |
return a.location.localeCompare(b.location); | |
}); | |
} | |
return data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment