Bunch v1.0.0 Bunch.KVList View Source
A bunch of helper functions for manipulating key-value lists (including keyword lists).
Key-value lists are represented as lists of 2-element tuples, where the first element of each tuple is a key, and the second is a value.
Link to this section Summary
Link to this section Types
Link to this type
t(key, value)
View Source
t(key, value)
View Source
t(key, value) :: [{key, value}]
t(key, value) :: [{key, value}]
Link to this section Functions
Link to this function
map_keys(list, f) View Source
Maps keys of list
using function f
.
Example
iex> Bunch.KVList.map_keys([{1, :a}, {2, :b}], & &1+1)
[{2, :a}, {3, :b}]
Link to this function
map_values(list, f) View Source
Maps values of list
using function f
.
Example
iex> Bunch.KVList.map_values([a: 1, b: 2], & &1+1)
[a: 2, b: 3]