Skip to content

Instantly share code, notes, and snippets.

@afuggini
Forked from sclausen/gist:7c655d0a99c0a434e066
Last active August 29, 2015 14:03
Show Gist options
  • Save afuggini/e3862e5ef27722989c6e to your computer and use it in GitHub Desktop.
Save afuggini/e3862e5ef27722989c6e to your computer and use it in GitHub Desktop.
Turn object into array to then iterate helper
Template.foo.helpers({
data1: function(){
var array = [];
var storedData = Session.get("data");
//underscore
_.each(Object.keys(storedData),function(key){
array.push(storedData[key]);
});
return array;
},
data2: function(){
var array = [];
var storedData = Session.get("data");
//lodash
_.forIn(storedData, function(key){
array.push(storedData[key]);
});
return array;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment