code: function stateAndPayloadAreValid(config, state, payload) {
  
          // ensure that the instances array exists
          if (!Array.isArray(state[config.stateKey])) {
              console.error('State does not contain an "' + config.stateKey + '" array.');
              return false;
          }
  
          // ensure that the payload contains an id
          if ((typeof payload === 'undefined' ? 'undefined' : _typeof(payload)) !== 'object' || typeof payload[config.instanceKey] === 'undefined') {
              console.error('Mutation payloads must be an object with an "' + config.instanceKey + '" property.');
              return false;
          }
  
          return true;
      }
docs: check if the state or payload is malformed