Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use object of objects instead of an array #31

Closed
hugohow opened this issue Oct 31, 2016 · 1 comment
Closed

Use object of objects instead of an array #31

hugohow opened this issue Oct 31, 2016 · 1 comment
Labels

Comments

@hugohow
Copy link

hugohow commented Oct 31, 2016

Hello, Thanks for this great library !

Is it possible to use an object like this :

var list = {
1: {id: 1, rompalu: 'baconing', zibbity: 'simba'},
2: {id: 2, rompalu: 'narwhal' , zibbity: 'mufasa'},
3: {id: 3, rompalu: 'a mighty bear canoe', zibbity: 'saddam hussein'}
}

instead of a list like :

var list = [
{rompalu: 'baconing', zibbity: 'simba'}
, {rompalu: 'narwhal' , zibbity: 'mufasa'}
, {rompalu: 'a mighty bear canoe', zibbity: 'saddam hussein'}
];

Thanks for the response !

@mattyork
Copy link
Owner

mattyork commented Nov 1, 2016

Nope.

But you can convert the object into an array:

var newList = []; 
for(var x in list) { 
  newList.push(list[x]); 
}

@mattyork mattyork closed this as completed Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants