function validateRSAA(action) {
  var validationErrors = [];
  var validCallAPIKeys = ['endpoint', 'method', 'body', 'headers', 'credentials', 'bailout', 'types'];
  var validMethods = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'];
  var validCredentials = ['omit', 'same-origin', 'include'];

  if (!isRSAA(action)) {
    validationErrors.push('RSAAs must be plain JavaScript objects with a [CALL_API] property');
    return validationErrors;
  }

  for (var key in action) {
    if (key !== [_CALL_API2['default']]) {
      validationErrors.push('Invalid root key: ' + key);
    }
  }

  var callAPI = action[_CALL_API2['default']];
  if (!_lodashIsplainobject2['default'](callAPI)) {
    validationErrors.push('[CALL_API] property must be a plain JavaScript object');
  }
  for (var key in callAPI) {
    if (! ~validCallAPIKeys.indexOf(key)) {
      validationErrors.push('Invalid [CALL_API] key: ' + key);
    }
  }

  var endpoint = callAPI.endpoint;
  var method = callAPI.method;
  var headers = callAPI.headers;
  var credentials = callAPI.credentials;
  var types = callAPI.types;
  var bailout = callAPI.bailout;

  if (typeof endpoint === 'undefined') {
    validationErrors.push('[CALL_API] must have an endpoint property');
  } else if (typeof endpoint !== 'string' && typeof endpoint !== 'function') {
    validationErrors.push('[CALL_API].endpoint property must be a string or a function');
  }
  if (typeof method === 'undefined') {
    validationErrors.push('[CALL_API] must have a method property');
  } else if (typeof method !== 'string') {
    validationErrors.push('[CALL_API].method property must be a string');
  } else if (! ~validMethods.indexOf(method.toUpperCase())) {
    validationErrors.push('Invalid [CALL_API].method: ' + method.toUpperCase());
  }

  if (typeof headers !== 'undefined' && !_lodashIsplainobject2['default'](headers) && typeof headers !== 'function') {
    validationErrors.push('[CALL_API].headers property must be undefined, a plain JavaScript object, or a function');
  }
  if (typeof credentials !== 'undefined') {
    if (typeof credentials !== 'string') {
      validationErrors.push('[CALL_API].credentials property must be undefined, or a string');
    } else if (! ~validCredentials.indexOf(credentials)) {
      validationErrors.push('Invalid [CALL_API].credentials: ' + credentials);
    }
  }
  if (typeof bailout !== 'undefined' && typeof bailout !== 'boolean' && typeof bailout !== 'function') {
    validationErrors.push('[CALL_API].bailout property must be undefined, a boolean, or a function');
  }

  if (typeof types === 'undefined') {
    validationErrors.push('[CALL_API] must have a types property');
  } else if (!Array.isArray(types) || types.length !== 3) {
    validationErrors.push('[CALL_API].types property must be an array of length 3');
  } else {
    var requestType = types[0];
    var successType = types[1];
    var failureType = types[2];

    if (typeof requestType !== 'string' && typeof requestType !== 'symbol' && !isValidTypeDescriptor(requestType)) {
      validationErrors.push('Invalid request type');
    }
    if (typeof successType !== 'string' && typeof successType !== 'symbol' && !isValidTypeDescriptor(successType)) {
      validationErrors.push('Invalid success type');
    }
    if (typeof failureType !== 'string' && typeof failureType !== 'symbol' && !isValidTypeDescriptor(failureType)) {
      validationErrors.push('Invalid failure type');
    }
  }

  return validationErrors;
}
/**
 * Checks an action against the RSAA definition, returning a (possibly empty)
 * array of validation errors.
 *
 * @function validateRSAA
 * @access public
 * @param {object} action - The action to check against the RSAA definition
 * @returns {array}
 */
Checks an action against the RSAA definition, returning a (possibly empty)
array of validation errors.

@function validateRSAA
@access public
@param {object} action - The action to check against the RSAA definition
@returns {array}
Checks an action against the RSAA definition returning a ( possibly empty ) array of validation errors . @function validateRSAA @access public @param { object } action - The action to check against the RSAA definition @returns { array }
function validateRSAA(action) {
  var validationErrors = [];
  var validCallAPIKeys = ['endpoint', 'method', 'body', 'headers', 'credentials', 'bailout', 'types'];
  var validMethods = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'];
  var validCredentials = ['omit', 'same-origin', 'include'];
  if (!isRSAA(action)) {
    validationErrors.push('RSAAs must be plain JavaScript objects with a [CALL_API] property');
    return validationErrors;
  }
  for (var key in action) {
    if (key !== [_CALL_API2['default']]) {
      validationErrors.push('Invalid root key: ' + key);
    }
  }
  var callAPI = action[_CALL_API2['default']];
  if (!_lodashIsplainobject2['default'](callAPI)) {
    validationErrors.push('[CALL_API] property must be a plain JavaScript object');
  }
  for (var key in callAPI) {
    if (! ~validCallAPIKeys.indexOf(key)) {
      validationErrors.push('Invalid [CALL_API] key: ' + key);
    }
  }
  var endpoint = callAPI.endpoint;
  var method = callAPI.method;
  var headers = callAPI.headers;
  var credentials = callAPI.credentials;
  var types = callAPI.types;
  var bailout = callAPI.bailout;
  if (typeof endpoint === 'undefined') {
    validationErrors.push('[CALL_API] must have an endpoint property');
  } else if (typeof endpoint !== 'string' && typeof endpoint !== 'function') {
    validationErrors.push('[CALL_API].endpoint property must be a string or a function');
  }
  if (typeof method === 'undefined') {
    validationErrors.push('[CALL_API] must have a method property');
  } else if (typeof method !== 'string') {
    validationErrors.push('[CALL_API].method property must be a string');
  } else if (! ~validMethods.indexOf(method.toUpperCase())) {
    validationErrors.push('Invalid [CALL_API].method: ' + method.toUpperCase());
  }
  if (typeof headers !== 'undefined' && !_lodashIsplainobject2['default'](headers) && typeof headers !== 'function') {
    validationErrors.push('[CALL_API].headers property must be undefined, a plain JavaScript object, or a function');
  }
  if (typeof credentials !== 'undefined') {
    if (typeof credentials !== 'string') {
      validationErrors.push('[CALL_API].credentials property must be undefined, or a string');
    } else if (! ~validCredentials.indexOf(credentials)) {
      validationErrors.push('Invalid [CALL_API].credentials: ' + credentials);
    }
  }
  if (typeof bailout !== 'undefined' && typeof bailout !== 'boolean' && typeof bailout !== 'function') {
    validationErrors.push('[CALL_API].bailout property must be undefined, a boolean, or a function');
  }
  if (typeof types === 'undefined') {
    validationErrors.push('[CALL_API] must have a types property');
  } else if (!Array.isArray(types) || types.length !== 3) {
    validationErrors.push('[CALL_API].types property must be an array of length 3');
  } else {
    var requestType = types[0];
    var successType = types[1];
    var failureType = types[2];
    if (typeof requestType !== 'string' && typeof requestType !== 'symbol' && !isValidTypeDescriptor(requestType)) {
      validationErrors.push('Invalid request type');
    }
    if (typeof successType !== 'string' && typeof successType !== 'symbol' && !isValidTypeDescriptor(successType)) {
      validationErrors.push('Invalid success type');
    }
    if (typeof failureType !== 'string' && typeof failureType !== 'symbol' && !isValidTypeDescriptor(failureType)) {
      validationErrors.push('Invalid failure type');
    }
  }
  return validationErrors;
}
function validateRSAA ( action ) { var validationErrors = [ ] ; var validCallAPIKeys = [ 'endpoint' , 'method' , 'body' , 'headers' , 'credentials' , 'bailout' , 'types' ] ; var validMethods = [ 'GET' , 'HEAD' , 'POST' , 'PUT' , 'PATCH' , 'DELETE' , 'OPTIONS' ] ; var validCredentials = [ 'omit' , 'same-origin' , 'include' ] ; if ( ! isRSAA ( action ) ) { validationErrors . push ( 'RSAAs must be plain JavaScript objects with a [CALL_API] property' ) ; return validationErrors ; } for ( var key in action ) { if ( key !== [ _CALL_API2 [ 'default' ] ] ) { validationErrors . push ( 'Invalid root key: ' + key ) ; } } var callAPI = action [ _CALL_API2 [ 'default' ] ] ; if ( ! _lodashIsplainobject2 [ 'default' ] ( callAPI ) ) { validationErrors . push ( '[CALL_API] property must be a plain JavaScript object' ) ; } for ( var key in callAPI ) { if ( ! ~ validCallAPIKeys . indexOf ( key ) ) { validationErrors . push ( 'Invalid [CALL_API] key: ' + key ) ; } } var endpoint = callAPI . endpoint ; var method = callAPI . method ; var headers = callAPI . headers ; var credentials = callAPI . credentials ; var types = callAPI . types ; var bailout = callAPI . bailout ; if ( typeof endpoint === 'undefined' ) { validationErrors . push ( '[CALL_API] must have an endpoint property' ) ; } else if ( typeof endpoint !== 'string' && typeof endpoint !== 'function' ) { validationErrors . push ( '[CALL_API].endpoint property must be a string or a function' ) ; } if ( typeof method === 'undefined' ) { validationErrors . push ( '[CALL_API] must have a method property' ) ; } else if ( typeof method !== 'string' ) { validationErrors . push ( '[CALL_API].method property must be a string' ) ; } else if ( ! ~ validMethods . indexOf ( method . toUpperCase ( ) ) ) { validationErrors . push ( 'Invalid [CALL_API].method: ' + method . toUpperCase ( ) ) ; } if ( typeof headers !== 'undefined' && ! _lodashIsplainobject2 [ 'default' ] ( headers ) && typeof headers !== 'function' ) { validationErrors . push ( '[CALL_API].headers property must be undefined, a plain JavaScript object, or a function' ) ; } if ( typeof credentials !== 'undefined' ) { if ( typeof credentials !== 'string' ) { validationErrors . push ( '[CALL_API].credentials property must be undefined, or a string' ) ; } else if ( ! ~ validCredentials . indexOf ( credentials ) ) { validationErrors . push ( 'Invalid [CALL_API].credentials: ' + credentials ) ; } } if ( typeof bailout !== 'undefined' && typeof bailout !== 'boolean' && typeof bailout !== 'function' ) { validationErrors . push ( '[CALL_API].bailout property must be undefined, a boolean, or a function' ) ; } if ( typeof types === 'undefined' ) { validationErrors . push ( '[CALL_API] must have a types property' ) ; } else if ( ! Array . isArray ( types ) || types . length !== 3 ) { validationErrors . push ( '[CALL_API].types property must be an array of length 3' ) ; } else { var requestType = types [ 0 ] ; var successType = types [ 1 ] ; var failureType = types [ 2 ] ; if ( typeof requestType !== 'string' && typeof requestType !== 'symbol' && ! isValidTypeDescriptor ( requestType ) ) { validationErrors . push ( 'Invalid request type' ) ; } if ( typeof successType !== 'string' && typeof successType !== 'symbol' && ! isValidTypeDescriptor ( successType ) ) { validationErrors . push ( 'Invalid success type' ) ; } if ( typeof failureType !== 'string' && typeof failureType !== 'symbol' && ! isValidTypeDescriptor ( failureType ) ) { validationErrors . push ( 'Invalid failure type' ) ; } } return validationErrors ; }
Checks an action against the RSAA definition, returning a (possibly empty)
 array of validation errors.
Checks an action against the RSAA definition returning a ( possibly empty ) array of validation errors .