code: function(location, precision) {
    validateLocation(location);
    if (typeof precision !== "undefined") {
      if (typeof precision !== "number" || isNaN(precision)) {
        throw new Error("precision must be a number");
      }
      else if (precision <= 0) {
        throw new Error("precision must be greater than 0");
      }
      else if (precision > 22) {
        throw new Error("precision cannot be greater than 22");
      }
      else if (Math.round(precision) !== precision) {
        throw new Error("precision must be an integer");
      }
    }
  
    // 如果没有指定精度，使用全局默认的精度值
    precision = precision || g_GEOHASH_PRECISION;
  
    var latitudeRange = {
      min: -90,
      max: 90
    };
    var longitudeRange = {
      min: -180,
      max: 180
    };
    var hash = "";
    var hashVal = 0;
    var bits = 0;
    var even = 1;
  
    while (hash.length < precision) {
      var val = even ? location[1] : location[0];
      var range = even ? longitudeRange : latitudeRange;
      var mid = (range.min + range.max) / 2;
  
      /* jshint -W016 */
      if (val > mid) {
        hashVal = (hashVal << 1) + 1;
        range.min = mid;
      }
      else {
        hashVal = (hashVal << 1) + 0;
        range.max = mid;
      }
      /* jshint +W016 */
  
      even = !even;
      if (bits < 4) {
        bits++;
      }
      else {
        bits = 0;
        hash += g_BASE32[hashVal];
        hashVal = 0;
      }
    }
  
    return hash;
  }
docs: 由[latitude, longitude]坐标数组对产生指定精度/字符长度的geohash值
  @param {Array.<number>} [latitude, longitude]坐标数组
  @param {number=} precision 生成geohash值的精度，如果没有指定精度，采用全局默认的精度
  @return {string} 输入坐标的geohash值