Skip to content

dict::createLookup ​

createLookup(values) ​

ParameterTypeDescription
valuesIterableAn Iterable of key-value-pairs

Returns ​

(Dictionary) A new Dictionary based on the given values, where duplicate keys are merged and their values are combined into a list.

Example ​

elk
[["a", 1], ["a", 2], ["b", 3]] | dict::create
#=>
# {
#   "a": [1, 2],
#   "b": [3],
# }
[["a", 1], ["a", 2], ["b", 3]] | dict::create
#=>
# {
#   "a": [1, 2],
#   "b": [3],
# }