lib/metadata/schema-parser.js
function getByVersion(options, cc, udtResolver, version, currentInstance) {
  let parserConstructor = SchemaParserV1;
  if (version && version[0] === 3) {
    parserConstructor = SchemaParserV2;
  } else if (version && version[0] >= 4) {
    parserConstructor = SchemaParserV3;
  }
  if (!currentInstance || !(currentInstance instanceof parserConstructor)){
    return new parserConstructor(options, cc, udtResolver);
  }
  return currentInstance;
}
function getByVersion(options, cc, udtResolver, version, currentInstance) {
  let parserConstructor = SchemaParserV1;
  if (version && version[0] === 3) {
    parserConstructor = SchemaParserV2;
  } else if (version && version[0] >= 4) {
    parserConstructor = SchemaParserV3;
  }
  if (!currentInstance || !(currentInstance instanceof parserConstructor)){
    return new parserConstructor(options, cc, udtResolver);
  }
  return currentInstance;
}
Creates a new instance if the currentInstance is not valid for the
provided Cassandra version
@param {ClientOptions} options The client options
@param {ControlConnection} cc The control connection to be used
@param {Function} udtResolver The function to be used to retrieve the udts.
@param {Array.<Number>} [version] The cassandra version
@param {SchemaParser} [currentInstance] The current instance
@returns {SchemaParser}