-
-
Save afuggini/e3862e5ef27722989c6e to your computer and use it in GitHub Desktop.
Turn object into array to then iterate helper
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
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