lib/client-options.js
function validateEncodingOptions(encodingOptions) {
  if (encodingOptions.map) {
    const mapConstructor = encodingOptions.map;
    if (typeof mapConstructor !== 'function' ||
      typeof mapConstructor.prototype.forEach !== 'function' ||
      typeof mapConstructor.prototype.set !== 'function') {
      throw new TypeError('Map constructor not valid');
    }
  }

  if (encodingOptions.set) {
    const setConstructor = encodingOptions.set;
    if (typeof setConstructor !== 'function' ||
      typeof setConstructor.prototype.forEach !== 'function' ||
      typeof setConstructor.prototype.add !== 'function') {
      throw new TypeError('Set constructor not valid');
    }
  }

  if ((encodingOptions.useBigIntAsLong || encodingOptions.useBigIntAsVarint) && typeof BigInt === 'undefined') {
    throw new TypeError('BigInt is not supported by the JavaScript engine');
  }
}
function validateEncodingOptions(encodingOptions) {
  if (encodingOptions.map) {
    const mapConstructor = encodingOptions.map;
    if (typeof mapConstructor !== 'function' ||
      typeof mapConstructor.prototype.forEach !== 'function' ||
      typeof mapConstructor.prototype.set !== 'function') {
      throw new TypeError('Map constructor not valid');
    }
  }

  if (encodingOptions.set) {
    const setConstructor = encodingOptions.set;
    if (typeof setConstructor !== 'function' ||
      typeof setConstructor.prototype.forEach !== 'function' ||
      typeof setConstructor.prototype.add !== 'function') {
      throw new TypeError('Set constructor not valid');
    }
  }

  if ((encodingOptions.useBigIntAsLong || encodingOptions.useBigIntAsVarint) && typeof BigInt === 'undefined') {
    throw new TypeError('BigInt is not supported by the JavaScript engine');
  }
}
function validateEncodingOptions ( encodingOptions ) { if ( encodingOptions . map ) { const mapConstructor = encodingOptions . map ; if ( typeof mapConstructor !== 'function' || typeof mapConstructor . prototype . forEach !== 'function' || typeof mapConstructor . prototype . set !== 'function' ) { throw new TypeError ( 'Map constructor not valid' ) ; } } if ( encodingOptions . set ) { const setConstructor = encodingOptions . set ; if ( typeof setConstructor !== 'function' || typeof setConstructor . prototype . forEach !== 'function' || typeof setConstructor . prototype . add !== 'function' ) { throw new TypeError ( 'Set constructor not valid' ) ; } } if ( ( encodingOptions . useBigIntAsLong || encodingOptions . useBigIntAsVarint ) && typeof BigInt === 'undefined' ) { throw new TypeError ( 'BigInt is not supported by the JavaScript engine' ) ; } }
Validates the encoding options.
@param {ClientOptions.encoding} encodingOptions
@private
Validates the encoding options .