export const getActionPayload = action =>
  action.payload === undefined ? action : action.payload;

export const isRequestAction = action => {
  const actionPayload = getActionPayload(action);
  return (
    !!actionPayload.request &&
    !actionPayload.response &&
    !(actionPayload instanceof Error)
  );
};

export const mapRequest = (request, callback) =>
  Array.isArray(request) ? request.map(callback) : callback(request);

export const getActionPayload = action =>
  action.payload === undefined ? action : action.payload;

export const isRequestAction = action => {
  const actionPayload = getActionPayload(action);
  return (
    !!actionPayload &&
    !!actionPayload.request &&
    !actionPayload.response &&
    !(actionPayload instanceof Error)
  );
};

export const mapRequest = (request, callback) =>
  Array.isArray(request) ? request.map(callback) : callback(request);

Fix fail when some action has a null payload
Fix fail when some action has a null payload
