src/index.js
/**
 * Verify that we have all the required environment variables.
 *
 * @param opts
 * @throws {Error}
 */
Verify that we have all the required environment variables.
@param opts
@throws {Error}
Verify that we have all the required environment variables . @param opts @throws { Error }
function validate(opts) {
  const arr = []
  if (!opts.url) arr.push('Missing env var REAL_TIME_URL.')
  if (!opts.token) arr.push('Missing env var REFOCUS_TOKEN.')
  if (!opts.namespace) arr.push('Missing env var NAMESPACE.')
  if (opts.namespace && !namespaces.includes(opts.namespace))
    arr.push(`Invalid NAMESPACE "${opts.namespace}" (must be one of [${namespaces}])`)
  if (arr.length) {
    throw new Error(['Cannot start refocus-real-time-client-example:'].concat(arr).join('\n  '));
  }
} 
function validate ( opts ) { const arr = [ ] if ( ! opts . url ) arr . push ( 'Missing env var REAL_TIME_URL.' ) if ( ! opts . token ) arr . push ( 'Missing env var REFOCUS_TOKEN.' ) if ( ! opts . namespace ) arr . push ( 'Missing env var NAMESPACE.' ) if ( opts . namespace && ! namespaces . includes ( opts . namespace ) ) arr . push ( ` ${ opts . namespace } ${ namespaces } ` ) if ( arr . length ) { throw new Error ( [ 'Cannot start refocus-real-time-client-example:' ] . concat ( arr ) . join ( '\n  ' ) ) ; } }
Verify that we have all the required environment variables.
Verify that we have all the required environment variables .
// validate