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

Different approaches in iterable objects in different contexts of "each - in" #1420

jalooc opened this issue Dec 9, 2015 · 3 comments


Copy link

@jalooc jalooc commented Dec 9, 2015

In documentation you present different approaches in handling iterable objects using each attribute:

  1. If it's an array, the extracted in each="{ name, i in arr }" variables are: first one - value; second one - key.
  2. If it's an object, the extracted in each="{ name, value in obj }" variables are: first one - key; second one - value.

In my opinion it would be better to maintain consistency.

Now I realize, that changing the behavior may be confusing for current users of Riot.js, but it's certainly confusing for newcomers. (I too, sometimes, have to stop and think about the order of variables in each - in, even though I have been using Riot.js for several weeks now).

@rsbondi rsbondi added the discussion label Dec 9, 2015
Copy link

@aMarCruz aMarCruz commented Dec 9, 2015

agree, also confused me the use of name for two different things.

Copy link

@nippur72 nippur72 commented Dec 11, 2015

+1 the syntax should be each={ value, indexer in obj } in both cases.

Copy link

@sylvainpolletvillard sylvainpolletvillard commented Dec 11, 2015

it always confuse me too. Sure, this is annoying to change that now, but it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.