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

Closed
jalooc opened this Issue Dec 9, 2015 · 3 comments

Comments

Projects
None yet
6 participants
@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

@aMarCruz

This comment has been minimized.

Show comment
Hide comment
@aMarCruz

aMarCruz Dec 9, 2015

Member

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

Member

aMarCruz commented Dec 9, 2015

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

@nippur72

This comment has been minimized.

Show comment
Hide comment
@nippur72

nippur72 Dec 11, 2015

Contributor

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

Contributor

nippur72 commented Dec 11, 2015

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

@sylvainpolletvillard

This comment has been minimized.

Show comment
Hide comment
@sylvainpolletvillard

sylvainpolletvillard Dec 11, 2015

Contributor

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

Contributor

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