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

jalooc opened this Issue Dec 9, 2015 · 3 comments


None yet

6 participants

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 commented Dec 9, 2015

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


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


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

@GianlucaGuarini GianlucaGuarini added this to the 3.0.0 milestone Feb 27, 2016
@GianlucaGuarini GianlucaGuarini self-assigned this Feb 27, 2016
@GianlucaGuarini GianlucaGuarini added a commit that closed this issue Nov 22, 2016
@GianlucaGuarini GianlucaGuarini closes #1420 5f94810
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment