Team-Sass/SassyLists — pull request #35 by lolmaus (2014-06-28 21:19:16+00:00)
Title: Upgraded `to-map()` with warnings, support for zero-based indexing & more

> Hey Hugo. ^_^
>
> I stumbled upon [this](http://csspre.com/loops) and noticed that it lacks the `@each` loop.
>
> Then i noticed that the example requires an index variable.
>
> Then i remembered [having solved](https://github.com/sass/sass/issues/996#issuecomment-32000596) this case before.
>
> Then i decided to have a look whether your SassyLists has this function and didn't find one.
>
> So i created one for you.
>
> But before submitting a pull request i decided to have a look into your roadmap and found the function in the `next` branch.
>
> But my implementation seemed better to me, so i decided to send the pull request anyway.
>
> Don't hesitate to decline it if you feel so.
>
> PS I've tested it on SassMeister and it seems to work, but i didn't use this very code in any project. Looks like i've got a suggestion for your roadmap.

---

Upgraded `to-map()`:

* Added warnings against illegal arguments.
* Added optional parameter that allows indexing the resulting map starting with any number, e. g. zero.
* Added an alias `enumerate`, which is how Python folk refer to this feature.
* Expanded the description with my favorite use case:

```sass
@each $i, $value in enumerate($list)
```