A middleware and higher order function to enable validation of actions before they ever reach a reducer