src/Node.js
function _validateSettings (settings) {
  let {
    host,
    external,
    voteTimeout,
    electionPriority,
    coordinationPort
  } = settings

  if (!host || !isString(host)) throw new TypeError(ctorMessage('host is mandatory and should be a string.'))

  if (!isInteger(coordinationPort) || coordinationPort <= 0) throw new TypeError(ctorMessage('settings.coordinationPort should be a positive integer.'))

  if (!external) {
    if (!isInteger(voteTimeout) || voteTimeout <= 0) throw new TypeError(ctorMessage('settings.voteTimeout should be a positive integer.'))
    if (!isInteger(electionPriority) || electionPriority < 0 || electionPriority > 99) throw new TypeError(ctorMessage('settings.electionPriority should be an integer between 0 and 99.'))
  }
}
function _validateSettings (settings) {
  let {
    host,
    external,
    voteTimeout,
    electionPriority,
    coordinationPort
  } = settings

  if (!host || !isString(host)) throw new TypeError(ctorMessage('host is mandatory and should be a string.'))

  if (!isInteger(coordinationPort) || coordinationPort <= 0) throw new TypeError(ctorMessage('settings.coordinationPort should be a positive integer.'))

  if (!external) {
    if (!isInteger(voteTimeout) || voteTimeout <= 0) throw new TypeError(ctorMessage('settings.voteTimeout should be a positive integer.'))
    if (!isInteger(electionPriority) || electionPriority < 0 || electionPriority > 99) throw new TypeError(ctorMessage('settings.electionPriority should be an integer between 0 and 99.'))
  }
}
function _validateSettings ( settings ) { let { host , external , voteTimeout , electionPriority , coordinationPort } = settings if ( ! host || ! isString ( host ) ) throw new TypeError ( ctorMessage ( 'host is mandatory and should be a string.' ) ) if ( ! isInteger ( coordinationPort ) || coordinationPort <= 0 ) throw new TypeError ( ctorMessage ( 'settings.coordinationPort should be a positive integer.' ) ) if ( ! external ) { if ( ! isInteger ( voteTimeout ) || voteTimeout <= 0 ) throw new TypeError ( ctorMessage ( 'settings.voteTimeout should be a positive integer.' ) ) if ( ! isInteger ( electionPriority ) || electionPriority < 0 || electionPriority > 99 ) throw new TypeError ( ctorMessage ( 'settings.electionPriority should be an integer between 0 and 99.' ) ) } }
Validates a map of node settings
@param  {object} settings
Validates a map of node settings