code: function encode(str) {
    var result = '',
        bytes = utf8Encode(str),
        length = bytes.length,
        i;
  
    // Convert every three bytes to 4 ascii characters.
    for (i = 0; i < (length - 2); i += 3) {
      result += chrTable[bytes[i] >> 2];
      result += chrTable[((bytes[i] & 0x03) << 4) + (bytes[i + 1] >> 4)];
      result += chrTable[((bytes[i + 1] & 0x0f) << 2) + (bytes[i + 2] >> 6)];
      result += chrTable[bytes[i + 2] & 0x3f];
    }
  
    // Convert the remaining 1 or 2 bytes, pad out to 4 characters.
    if (length % 3) {
      i = length - (length % 3);
      result += chrTable[bytes[i] >> 2];
      if ((length % 3) === 2) {
        result += chrTable[((bytes[i] & 0x03) << 4) + (bytes[i + 1] >> 4)];
        result += chrTable[(bytes[i + 1] & 0x0f) << 2];
        result += padding;
      } else {
        result += chrTable[(bytes[i] & 0x03) << 4];
        result += padding + padding;
      }
    }
  
    return result;
  }
docs: public api ////////////////////////////////////////////////////////////////