lib/types/index.js
function(name) {
    name = name.toLowerCase();
    if (name.indexOf('<') > 0) {
      const listMatches = /^(list|set)<(.+)>$/.exec(name);
      if (listMatches) {
        return { code: this[listMatches[1]], info: this.getByName(listMatches[2])};
      }
      const mapMatches = /^(map)< *(.+) *, *(.+)>$/.exec(name);
      if (mapMatches) {
        return { code: this[mapMatches[1]], info: [this.getByName(mapMatches[2]), this.getByName(mapMatches[3])]};
      }
      const udtMatches = /^(udt)<(.+)>$/.exec(name);
      if (udtMatches) {
        //udt name as raw string
        return { code: this[udtMatches[1]], info: udtMatches[2]};
      }
      const tupleMatches = /^(tuple)<(.+)>$/.exec(name);
      if (tupleMatches) {
        //tuple info as an array of types
        return { code: this[tupleMatches[1]], info: tupleMatches[2].split(',').map(function (x) {
          return this.getByName(x.trim());
        }, this)};
      }
    }
    const typeInfo = { code: this[name], info: null};
    if (typeof typeInfo.code !== 'number') {
      throw new TypeError('Data type with name ' + name + ' not valid');
    }
    return typeInfo;
  }
function(name) {
    name = name.toLowerCase();
    if (name.indexOf('<') > 0) {
      const listMatches = /^(list|set)<(.+)>$/.exec(name);
      if (listMatches) {
        return { code: this[listMatches[1]], info: this.getByName(listMatches[2])};
      }
      const mapMatches = /^(map)< *(.+) *, *(.+)>$/.exec(name);
      if (mapMatches) {
        return { code: this[mapMatches[1]], info: [this.getByName(mapMatches[2]), this.getByName(mapMatches[3])]};
      }
      const udtMatches = /^(udt)<(.+)>$/.exec(name);
      if (udtMatches) {
        //udt name as raw string
        return { code: this[udtMatches[1]], info: udtMatches[2]};
      }
      const tupleMatches = /^(tuple)<(.+)>$/.exec(name);
      if (tupleMatches) {
        //tuple info as an array of types
        return { code: this[tupleMatches[1]], info: tupleMatches[2].split(',').map(function (x) {
          return this.getByName(x.trim());
        }, this)};
      }
    }
    const typeInfo = { code: this[name], info: null};
    if (typeof typeInfo.code !== 'number') {
      throw new TypeError('Data type with name ' + name + ' not valid');
    }
    return typeInfo;
  }
function ( name ) { name = name . toLowerCase ( ) ; if ( name . indexOf ( '<' ) > 0 ) { const listMatches = / ^(list|set)<(.+)>$ / . exec ( name ) ; if ( listMatches ) { return { code : this [ listMatches [ 1 ] ] , info : this . getByName ( listMatches [ 2 ] ) } ; } const mapMatches = / ^(map)< *(.+) *, *(.+)>$ / . exec ( name ) ; if ( mapMatches ) { return { code : this [ mapMatches [ 1 ] ] , info : [ this . getByName ( mapMatches [ 2 ] ) , this . getByName ( mapMatches [ 3 ] ) ] } ; } const udtMatches = / ^(udt)<(.+)>$ / . exec ( name ) ; if ( udtMatches ) { //udt name as raw string return { code : this [ udtMatches [ 1 ] ] , info : udtMatches [ 2 ] } ; } const tupleMatches = / ^(tuple)<(.+)>$ / . exec ( name ) ; if ( tupleMatches ) { //tuple info as an array of types return { code : this [ tupleMatches [ 1 ] ] , info : tupleMatches [ 2 ] . split ( ',' ) . map ( function ( x ) { return this . getByName ( x . trim ( ) ) ; } , this ) } ; } } const typeInfo = { code : this [ name ] , info : null } ; if ( typeof typeInfo . code !== 'number' ) { throw new TypeError ( 'Data type with name ' + name + ' not valid' ) ; } return typeInfo ; }
Returns the typeInfo of a given type name
@param name
@returns {{code: number, info: *|Object}}
Returns the typeInfo of a given type name