index.js
function addHook(hooks, hook) {
    hooks.push(hook)
    return function () {
      var i = hooks.indexOf(hook)
      if (i >= 0) return hooks.splice(i, 1)
    }
  }
function addHook(hooks, hook) {
    hooks.push(hook)
    return function () {
      var i = hooks.indexOf(hook)
      if (i >= 0) return hooks.splice(i, 1)
    }
  }
function addHook ( hooks , hook ) { hooks . push ( hook ) return function ( ) { var i = hooks . indexOf ( hook ) if ( i >= 0 ) return hooks . splice ( i , 1 ) } }
helper to register pre and post commit hooks
helper to register pre and post commit hooks