code: function packTo(value, theType, buffer, index=0) {
    return packArrayTo([value], theType, buffer, index);
  }
docs: Pack a number to a byte buffer.
  @param {number} value The value.
  @param {!Object} theType The type definition.
  @param {!Uint8Array|!Array<number>} buffer The output buffer.
  @param {number=} index The buffer index to write. Assumes 0 if undefined.
  @return {number} The next index to write.
  @throws {Error} If the type definition is not valid.
  @throws {Error} If the value is not valid.