docs: function builder(dataBuf, val, type, mata) {
      var tmpBuf,
          result,
          sgn,
          mantissa,
          exponent,
          smantissa,
          rmantissa,
          mdiff,
          int_mantissa;
  
      switch (type) {
          case 'int8' :
          case 'int16' :
          case 'int32' :
          case 'uint8':
          case 'uint16':
          case 'uint32':
          case 'floatle':
              dataBuf = dataBuf[type](val);
              break;
          case 'uint24':
              tmpBuf = val & 0xFFFF; 
              dataBuf = dataBuf.uint16(tmpBuf);
              tmpBuf = val >> 16;
              dataBuf = dataBuf.uint8(tmpBuf);
              break;
          case 'int24':
              tmpBuf = val & 0xFFFF; 
              dataBuf = dataBuf.uint16(tmpBuf);
              tmpBuf = val >> 16 & 0xFF;
              dataBuf = dataBuf.uint8(tmpBuf);
              break;
          case 'string':
              dataBuf = dataBuf.string(val, "utf8");
              break;
          case 'uuid':
          case 'addr3':
          case 'addr5':
          case 'addr6':
              val = str2Buf(val);
              dataBuf = dataBuf.buffer(val);
              break;
          case 'boolean':
              dataBuf = dataBuf.uint8(val);
              break;
          case 'stringPreLenUint8':
              dataBuf = dataBuf.uint8(val.length).string(val, 'utf8');
              break;
          case 'bufferPreLenUint8':
              dataBuf = dataBuf.uint8(val.length).buffer(val);
              break;
          case 'list':
              dataBuf = generateListBuf(dataBuf, val, mata.objInfo);
              break;
          case 'nibble': 
              nibbleBuf.push(val);
              if (nibbleBuf.length === 2) {
                  dataBuf = dataBuf.uint8(nibbleBuf[0] + (nibbleBuf[1] << 4));
                  nibbleBuf = [];
              }
              break;
          case 'sfloat':
              result = 0x07FF;
              sgn = val > 0 ? +1 : -1;
              mantissa = Math.abs(val);
              exponent = 0;
  
              if (isNaN(val)) {
                  dataBuf = dataBuf.uint16(result);
                  break;
              } else if (val > 20450000000.0) {
                  result = 0x07FE;
                  dataBuf = dataBuf.uint16(result);
                  break;
              } else if (val < -20450000000.0) {
                  result = 0x0802;
                  dataBuf = dataBuf.uint16(result);
                  break;
              } else if (val >= -1e-8 && val <= 1e-8) {
                  result = 0;
                  dataBuf = dataBuf.uint16(result);
                  break;
              }
  
              // scale up if number is too big
              while (mantissa > 0x07FD) {
                  mantissa /= 10.0;
                  ++exponent;
                  if (exponent > 7) {
                      // argh, should not happen
                      if (sgn > 0) {
                          result = 0x07FE;
                      } else {
                          result = 0x0802;
                      }
                      dataBuf = dataBuf.uint16(result);
                      break;
                  }
              }
  
              // scale down if number is too small
              while (mantissa < 1) {
                  mantissa *= 10;
                  --exponent;
                  if (exponent < -8) {
                      // argh, should not happen
                      result = 0;
                      dataBuf = dataBuf.uint16(result);
                      break;
                  }
              }
  
              smantissa = Math.round(mantissa * 10000);
              rmantissa = Math.round(mantissa) * 10000;
              mdiff = Math.abs(smantissa - rmantissa);
  
              while (mdiff > 0.5 && exponent > -8 && (mantissa * 10) <= 0x07FD) {
                  mantissa *= 10;
                  --exponent;
                  smantissa = Math.round(mantissa * 10000);
                  rmantissa = Math.round(mantissa) * 10000;
                  mdiff = Math.abs(smantissa - rmantissa);
              }
              int_mantissa = parseInt(Math.round(sgn * mantissa));
              result = ((exponent & 0xF) << 12) | (int_mantissa & 0xFFF);
              dataBuf = dataBuf.uint16(result);
              break;
          case 'float':
              result = 0x007FFFFF;
              sgn = val > 0 ? +1 : -1;
              mantissa = Math.abs(val);
              exponent = 0;
  
              if (isNaN(val)) {
                  dataBuf = dataBuf.uint32(result);
                  break;
              } else if (val > 8.388604999999999e+133) {
                  result = 0x007FFFFE;
                  dataBuf = dataBuf.uint32(result);
                  break;
              } else if (val < -(8.388604999999999e+133)) {
                  result = 0x00800002;
                  dataBuf = dataBuf.uint32(result);
                  break;
              } else if (val >= -(1e-128) && val <= 1e-128) {
                  result = 0;
                  dataBuf = dataBuf.uint32(result);
                  break;
              }
  
              // scale up if number is too big
              while (mantissa > 0x007FFFFD) {
                  mantissa /= 10.0;
                  ++exponent;
                  if (exponent > 127) {
                      // argh, should not happen
                      if (sgn > 0) {
                          result = 0x007FFFFE;
                      } else {
                          result = 0x00800002;
                      }
                      dataBuf = dataBuf.uint32(result);
                      break;
                  }
              }
  
              // scale down if number is too small
              while (mantissa < 1) {
                  mantissa *= 10;
                  --exponent;
                  if (exponent < -128) {
                      // argh, should not happen
                      result = 0;
                      dataBuf = dataBuf.uint32(result);
                      break;
                  }
              }
  
              // scale down if number needs more precision
              smantissa = Math.round(mantissa * 10000000);
              rmantissa = Math.round(mantissa) * 10000000;
              mdiff = Math.abs(smantissa - rmantissa);
              while (mdiff > 0.5 && exponent > -128 && (mantissa * 10) <= 0x007FFFFD) {
                  mantissa *= 10;
                  --exponent;
                  smantissa = Math.round(mantissa * 10000000);
                  rmantissa = Math.round(mantissa) * 10000000;
                  mdiff = Math.abs(smantissa - rmantissa);
              }
  
              int_mantissa = parseInt(Math.round(sgn * mantissa));
              result = ((exponent & 0xFF) << 24) | (int_mantissa & 0xFFFFFF);
              dataBuf = dataBuf.int32(result);
              break;
          case 'buffer': 
          case 'variable': 
              dataBuf = dataBuf.buffer(val);
              break;
          default:
              throw new Error("Unknown Data Type");
      }
  
      return dataBuf;
  }