code: function(geohash, bits) {
    validateGeohash(geohash);
    var precision = Math.ceil(bits/g_BITS_PER_CHAR);
    if (geohash.length < precision) {
      return [geohash, geohash+"~"];
    }
    geohash = geohash.substring(0, precision);
    var base = geohash.substring(0, geohash.length - 1);
    var lastValue = g_BASE32.indexOf(geohash.charAt(geohash.length - 1));
    var significantBits = bits - (base.length*g_BITS_PER_CHAR);
    var unusedBits = (g_BITS_PER_CHAR - significantBits);
    /*jshint bitwise: false*/
    // delete unused bits
    var startValue = (lastValue >> unusedBits) << unusedBits;
    var endValue = startValue + (1 << unusedBits);
    /*jshint bitwise: true*/
    if (endValue > 31) {
      return [base+g_BASE32[startValue], base+"~"];
    }
    else {
      return [base+g_BASE32[startValue], base+g_BASE32[endValue]];
    }
  }
docs: Calculates the bounding box query for a geohash with x bits precision.
  
  @param {string} geohash The geohash whose bounding box query to generate.
  @param {number} bits The number of bits of precision.
  @return {Array.<string>} A [start, end] pair of geohashes.