bitwalker / toml-elixir

An implementation of TOML for Elixir projects, compliant with the latest specification
Apache License 2.0
202 stars 24 forks source link

Support false as value #8

Closed thiamsantos closed 6 years ago

thiamsantos commented 6 years ago

As reported on #6, right now the provider does not load false values. This PR aims to solve this issue.

The cause of the problem was because list comprehensions discard all elements for which the filter expression returns false or nil. So whenever a value was false, this value was been discarded. A solution that I find for this was use the function Enum.into/2 to convert the map to a Keyword instead of the list comprehension.

bitwalker commented 6 years ago

I made a slight modification, but thanks for the PR! As an aside, you don't need to transform a value into a list before calling Enum.map/2, you can just call Enum.map/2 and the result will always be a list (even when the source is another type, like a map).