src/fprotocol/builders/abstract-method-builder.js
function reduceHooks (hooks) {
  return msg => {
    let tmp
    return hooks.reduce((prev, hook) => {
      tmp = hook(prev)
      if (tmp === undefined || tmp === null) { return prev }
      return tmp
    }, msg)
  }
}
function reduceHooks (hooks) {
  return msg => {
    let tmp
    return hooks.reduce((prev, hook) => {
      tmp = hook(prev)
      if (tmp === undefined || tmp === null) { return prev }
      return tmp
    }, msg)
  }
}
Apply hooks on a message in reduce fashion.
Hooks may return a new message. If it's not the case, the previous message is used for the next reduce step.
@private
@param  {function[]} hooks - Set of hooks
@return {function} A function that apply the set of hooks to a message