src/types.js
function readType(buffer, type, size) {
  switch (type) {
    case types.BYTE:
      return buffer.readBytes(size);
    case types.CHAR:
      return trimNull(buffer.readChars(size));
    case types.SHORT:
      return readNumber(size, buffer.readInt16.bind(buffer));
    case types.INT:
      return readNumber(size, buffer.readInt32.bind(buffer));
    case types.FLOAT:
      return readNumber(size, buffer.readFloat32.bind(buffer));
    case types.DOUBLE:
      return readNumber(size, buffer.readFloat64.bind(buffer));
      /* istanbul ignore next */
    default:
      notNetcdf(true, `non valid type ${type}`);
      return undefined;
  }
}
function readType(buffer, type, size) {
  switch (type) {
    case types.BYTE:
      return buffer.readBytes(size);
    case types.CHAR:
      return trimNull(buffer.readChars(size));
    case types.SHORT:
      return readNumber(size, buffer.readInt16.bind(buffer));
    case types.INT:
      return readNumber(size, buffer.readInt32.bind(buffer));
    case types.FLOAT:
      return readNumber(size, buffer.readFloat32.bind(buffer));
    case types.DOUBLE:
      return readNumber(size, buffer.readFloat64.bind(buffer));
      /* istanbul ignore next */
    default:
      notNetcdf(true, `non valid type ${type}`);
      return undefined;
  }
}
function readType ( buffer , type , size ) { switch ( type ) { case types . BYTE : return buffer . readBytes ( size ) ; case types . CHAR : return trimNull ( buffer . readChars ( size ) ) ; case types . SHORT : return readNumber ( size , buffer . readInt16 . bind ( buffer ) ) ; case types . INT : return readNumber ( size , buffer . readInt32 . bind ( buffer ) ) ; case types . FLOAT : return readNumber ( size , buffer . readFloat32 . bind ( buffer ) ) ; case types . DOUBLE : return readNumber ( size , buffer . readFloat64 . bind ( buffer ) ) ; /* istanbul ignore next */ default : notNetcdf ( true , ` ${ type } ` ) ; return undefined ; } }
Given a type and a size reads the next element
@ignore
@param {IOBuffer} buffer - Buffer for the file data
@param {number} type - Type of the data to read
@param {number} size - Size of the element to read
@return {string|Array<number>|number}
Given a type and a size reads the next element