KeywordLens.Helpers (keyword_lens v0.1.0) View Source

The naming is a bit strange because I can't use the same name as the procotol. This is essentially helper functions for KeywordLenses that might span protocol implementations.

Link to this section Summary

Functions

Takes a KeywordLens and turns it into a list of all of the lenses the KeywordLens describes.

Link to this section Functions

Takes a KeywordLens and turns it into a list of all of the lenses the KeywordLens describes.

Examples

iex> KeywordLens.Helpers.expand([a: :b])
[[:a, :b]]

iex> KeywordLens.Helpers.expand([a: [b: [:c, :d]]])
[[:a, :b, :d], [:a, :b, :c]]

iex> KeywordLens.Helpers.expand([a: [:z, b: [:c, d: :e]]])
[[:a, :b, :d, :e], [:a, :b, :c], [:a, :z]]

iex> KeywordLens.Helpers.expand([:a, "b", :c])
[[:c], ["b"], [:a]]