Cldr.Unit.Format.traverse

You're seeing just the function traverse, go back to Cldr.Unit.Format module for more information.

Traverses a unit's decomposition and invokes a function on each node of the composition tree.

Arguments

  • unit is any unit returned by Cldr.Unit.new/2

  • fun is any single-arity function. It will be invoked for each node of the composition tree. The argument is a tuple of the following form:

    • {:unit, argument}
    • {:times, {argument_1, argument_2}}
    • {:prefix, {prefix_unit, argument}}
    • {:power, {power_unit, argument}}
    • {:per, {argument_1, argument_2}} Where the arguments are the results returned from the fun/1.

Returns

The result returned from fun/1