Created
June 10, 2014 08:49
-
-
Save wiedi/fb09a0317e0db2caee6a to your computer and use it in GitHub Desktop.
handlebars helper to iterate by sorted object keys
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
Handlebars.registerHelper('eachSorted', function(context, options) { | |
var ret = "" | |
Object.keys(context).sort().forEach(function(key) { | |
ret = ret + options.fn({key: key, value: context[key]}) | |
}) | |
return ret | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment