Skip to content

Instantly share code, notes, and snippets.

@larzconwell
Created July 2, 2012 14:52
Show Gist options
  • Save larzconwell/3033631 to your computer and use it in GitHub Desktop.
Save larzconwell/3033631 to your computer and use it in GitHub Desktop.
<ul>
<% for (var p in params) { %>
<li><%= p + ': ' + params[p]; %></li>
<% } %>
</ul>
@OscarGodson
Copy link

Oh, so you want the key's name. I don't think so. In this case you'd want your object to look like:

{
  name: 'Foo',
  value: 'Bar'
}

// and use like...
var output = p.name + ': ' + p.value;

You could clone your object to create a new object like below and use that instead:

var newObj = {};
for (x in obj) {
  newObj.push({name: x, value: x.value})
}

@larzconwell
Copy link
Author

I could do something like that but I think it's a bit much just for generating resources with example content in Geddy. Thanks mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment