1.7.3.5 traverse(Fun, Acc, HookPoint)

-spec traverse(fun((fun(), Acc) -> {boolean(),
                                    Acc}),
               Acc, hookpoint()) -> Acc.

A generic function that traverses through hooks registered at HookPoint and passes them as an argument to Fun together with the accumulator value.

Fun should return a tuple where the first element is a boolean and the second is new value of the accumulator.

If it returns {true, Acc2} and the next hook exists, Fun will be called again the next next hook and the new value of the accumulator as arguments. Otherwise iteration stops and accumulator is returned.

JavaScript license information