function publishObject(inst, event, changedKeys, ignoreAttributes, opts) {
  if (!inst || !event) return false;

  const obj = {};
  obj[event] = inst;

  // set pub client and channel to perspective unless there are overrides opts
  let pubClient = pubPerspective;
  let channelName = perspectiveChannelName;
  if (opts) {
    obj[event].pubOpts = opts;
    pubClient = opts.client ? client[opts.client] : pubClient;
    channelName = opts.channel ? config.redis[opts.channel] : channelName;
  }

  /**
   * The shape of the object required for update events are a bit different.
   * changedKeys and ignoreAttributes are passed in as arrays by the
   * afterUpdate hooks of the models, which are passed to the prepareToPublish
   * to get the object just for update events.
   */
  if (Array.isArray(changedKeys) && Array.isArray(ignoreAttributes)) {
    const prepared = prepareToPublish(inst, changedKeys, ignoreAttributes);
    if (!prepared) return false;
    obj[event] = prepared;
  }

  pubClient.publish(channelName, JSON.stringify(obj));
  return obj;
} // publishObject
/**
 * This function publishes an created, updated or a deleted model instance to
 * the redis channel and returns the object that was published
 *
 * @param  {Object} inst - Model instance to be published
 * @param  {String} event  - Type of the event that is being published
 * @param  {[Array]} changedKeys - An array containing the fields of the model
 * that were changed
 * @param  {[Array]} ignoreAttributes An array containing the fields of the
 * model that should be ignored
 * @param  {Object} opts - Options for which client and channel to publish with
 * @returns {Object} - object that was published
 */
This function publishes an created, updated or a deleted model instance to
the redis channel and returns the object that was published


This function publishes an created updated or a deleted model instance to the redis channel and returns the object that was published
function publishObject(inst, event, changedKeys, ignoreAttributes, opts) {
  if (!inst || !event) return false;
  const obj = {};
  obj[event] = inst;
  let pubClient = pubPerspective;
  let channelName = perspectiveChannelName;
  if (opts) {
    obj[event].pubOpts = opts;
    pubClient = opts.client ? client[opts.client] : pubClient;
    channelName = opts.channel ? config.redis[opts.channel] : channelName;
  }
  if (Array.isArray(changedKeys) && Array.isArray(ignoreAttributes)) {
    const prepared = prepareToPublish(inst, changedKeys, ignoreAttributes);
    if (!prepared) return false;
    obj[event] = prepared;
  }
  pubClient.publish(channelName, JSON.stringify(obj));
  return obj;
} 
function publishObject ( inst , event , changedKeys , ignoreAttributes , opts ) { if ( ! inst || ! event ) return false ; const obj = { } ; obj [ event ] = inst ; let pubClient = pubPerspective ; let channelName = perspectiveChannelName ; if ( opts ) { obj [ event ] . pubOpts = opts ; pubClient = opts . client ? client [ opts . client ] : pubClient ; channelName = opts . channel ? config . redis [ opts . channel ] : channelName ; } if ( Array . isArray ( changedKeys ) && Array . isArray ( ignoreAttributes ) ) { const prepared = prepareToPublish ( inst , changedKeys , ignoreAttributes ) ; if ( ! prepared ) return false ; obj [ event ] = prepared ; } pubClient . publish ( channelName , JSON . stringify ( obj ) ) ; return obj ; }
This function publishes an created, updated or a deleted model instance to
 the redis channel and returns the object that was published
This function publishes an created updated or a deleted model instance to the redis channel and returns the object that was published
// set pub client and channel to perspective unless there are overrides opts /**
   * The shape of the object required for update events are a bit different.
   * changedKeys and ignoreAttributes are passed in as arrays by the
   * afterUpdate hooks of the models, which are passed to the prepareToPublish
   * to get the object just for update events.
   */ // publishObject