Bureaucrat.Util (bureaucrat v0.2.10)

Some functions used across Bureaucrat internally

Link to this section Summary

Functions

Takes a list of pre-sorted entries and groups them by given function, but returns a list of tuples [{k, v}, ...] instead of a Map to preserve key sort order, which can be given to Enum functions identically.

Link to this section Functions

Link to this function

stable_group_by(enumerable, key_fun, value_fun \\ fn x -> x end)

Takes a list of pre-sorted entries and groups them by given function, but returns a list of tuples [{k, v}, ...] instead of a Map to preserve key sort order, which can be given to Enum functions identically.

Implementation inspired by Enum.group_by/3 -> https://github.com/elixir-lang/elixir/blob/v1.4.2/lib/elixir/lib/enum.ex#L1036