Validates the inputted geohash and throws an error if it is invalid.
校验输入的geohash值，不合法则抛出错误
@param {string} geohash 被校验的geohash值.
179442
function(geohash) {
  var error;

  if (typeof geohash !== "string") {
    error = "geohash must be a string";
  }
  else if (geohash.length === 0) {
    error = "geohash cannot be the empty string";
  }
  else {
    for (var i = 0, length = geohash.length; i < length; ++i) {
      if (g_BASE32.indexOf(geohash[i]) === -1) {
        error = "geohash cannot contain \"" + geohash[i] + "\"";
      }
    }
  }

  if (typeof error !== "undefined") {
    throw new Error("Invalid WildGeo geohash '" + geohash + "': " + error);
  }
}
121335
function validateRegex(sRegex) {
		if (/.+/i.test(sRegex)) {
			return true;
		}
		Log.error("The regex value '" + sRegex + "' is not valid");
		return false;
	}
834257
private void validateRangeValue(String column, Object value) {
		if (constraintType != null && value != null
				&& !getConstraintType().equals(DataColumnConstraintType.RANGE)) {
			throw new GeoPackageException("The " + column
					+ " must be null for " + DataColumnConstraintType.ENUM
					+ " and " + DataColumnConstraintType.GLOB + " constraints");
		}
	}
1205988
public VerificationContextBuilder setDocumentHash(DataHash documentHash, Long level) {
        this.documentHash = documentHash;
        this.inputHashLevel = level;
        return this;
    }
733858
public static function validateHash($data, $hash) {

        if(false === is_string($data) && false === is_numeric($data)) {
            return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
        }

        if(false === is_string($hash)) {
            return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($hash)), E_USER_ERROR);
        }

        return hash(self :: HASH_ALGORITHM, $data) === $hash;
    }
652347
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  if(args.length > 1) {
    throw new CommandArgLength(cmd);
  }
}
800952
function validate(globs, options) {
    let hasError = false

    if (globs == null || globs.length === 0) {
        console.error("ERROR: requires file globs.")
        hasError = true
    }
    if (options.output != null && Array.isArray(options.output)) {
        console.error("ERROR: --output option should not be multiple.")
        hasError = true
    }
    if (options.prefix != null) {
        if (Array.isArray(options.prefix)) {
            console.error("ERROR: --prefix option should not be multiple.")
            hasError = true
        }
    }
    if (options.verbose && !options.output) {
        console.error("ERROR: --verbose option should be used together with --output option.")
        hasError = true
    }
    if (options.watch && !options.output) {
        console.error("ERROR: --watch option should be used together with --output option.")
        hasError = true
    }

    return !hasError
}
205108
private void validateValues(String column, long value, boolean allowZero) {
		if (value < 0 || (value == 0 && !allowZero)) {
			throw new GeoPackageException(column
					+ " value must be greater than "
					+ (allowZero ? "or equal to " : "") + "0: " + value);
		}
	}
44941
public void setMethodHash(XMethod method, byte[] methodHash) {
        methodHashMap.put(method, new MethodHash(method.getName(), method.getSignature(), method.isStatic(), methodHash));
    }
281701
function validateField (fields, key) {
  var value = fields[key] = castShorthand(fields[key])

  if (typeof value !== 'object')
    throw new TypeError('The definition of "' + key + '" must be an object.')

  if (key === primaryKey)
    throw new Error('Can not define primary key "' + primaryKey + '".')

  if (key in plainObject)
    throw new Error('Can not define field name "' + key +
      '" which is in Object.prototype.')

  if (!value[typeKey] && !value[linkKey])
    throw new Error('The definition of "' + key + '" must contain either ' +
      'the "' + typeKey + '" or "' + linkKey + '" property.')

  if (value[typeKey] && value[linkKey])
    throw new Error('Can not define both "' + typeKey + '" and "' + linkKey +
      '" on "' + key + '".')

  if (value[typeKey]) {
    if (typeof value[typeKey] === 'string')
      value[typeKey] = nativeTypes[
        stringifiedTypes.indexOf(value[typeKey].toLowerCase())]

    if (typeof value[typeKey] !== 'function')
      throw new Error('The "' + typeKey + '" on "' + key +
        '" must be a function.')

    if (!find(nativeTypes, function (type) {
      var hasMatch = type === value[typeKey] ||
        type.name === value[typeKey].name

      // In case this errors due to security sandboxing, just skip this check.
      if (!hasMatch)
        try {
          hasMatch = Object.create(value[typeKey]) instanceof type
        }
        catch (e) {
          hasMatch = true
        }

      return hasMatch
    }))
      throw new Error('The "' + typeKey + '" on "' + key + '" must be or ' +
        'inherit from a valid native type.')

    if (value[inverseKey])
      throw new Error('The field "' + inverseKey + '" may not be defined ' +
        'on "' + key + '".')
  }

  if (value[linkKey]) {
    if (typeof value[linkKey] !== 'string')
      throw new TypeError('The "' + linkKey + '" on "' + key +
        '" must be a string.')

    if (value[inverseKey] && typeof value[inverseKey] !== 'string')
      throw new TypeError('The "' + inverseKey + '" on "' + key + '" ' +
        'must be a string.')
  }

  if (value[isArrayKey] && typeof value[isArrayKey] !== 'boolean')
    throw new TypeError('The key "' + isArrayKey + '" on "' + key + '" ' +
        'must be a boolean.')
}
209214
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var start
    , end;

  if(args.length !== 1 && args.length !== 3) {
    throw new CommandArgLength(cmd);
  }

  if(args.length > 1) {
    start = parseInt('' + args[1]);
    if(isNaN(start)) throw IntegerRange;
    args[1] = start;
    end = parseInt('' + args[2]);
    if(isNaN(end)) throw IntegerRange;
    args[2] = end;
  }
}
324218
function validateScript(script) {
  var valid = this._validate(script);
  validateScript.errors = this._validate.errors;
  return valid;
}
233992
function hash(method) {
  // Is user supplies a function, use it and assume they will take of any
  // encoding (Base-64 or otherwise).
  if (typeof method === 'function') {
    return method;
  }

  if (hashFunctions.hasOwnProperty(method)) {
    return hashFunctions[method];
  }

  throw new Error(`Could not resolve hash function, received ${typeof method}.`);
}
503389
function validateDeep(map) {
  if (!(map instanceof Map)) {
    throw new Error(`Invalid graph: Expected Map instead found ${typeof map}`);
  }

  map.forEach((value, key) => {
    if (typeof value === 'object' && value instanceof Map) {
      validateDeep(value);
      return;
    }

    if (typeof value !== 'number' || value <= 0) {
      throw new Error(`Values must be numbers greater than 0. Found value ${value} at ${key}`);
    }
  });
}
881288
static String fromLongToString(long hash) {
        int length = (int) (hash & 0xf);
        if (length > 12 || length < 1)
            throw new IllegalArgumentException("invalid long geohash " + hash);
        char[] geohash = new char[length];
        for (int pos = 0; pos < length; pos++) {
            geohash[pos] = BASE32.charAt(((int) (hash >>> 59)));
            hash <<= 5;
        }
        return new String(geohash);
    }
781542
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var offset = parseInt('' + args[1]);
  if(isNaN(offset) || offset < 0 || offset > Constants.MAX_BIT_LEN) {
    throw IntegerRange;
  }
  args[1] = offset;
}
526026
function assertError(result, error) {
  if (typeof error === 'function') {
    if (!(result instanceof error || error(result) === true)) {
      throw result
    }
  } else if (typeof error === 'string') {
    assert(result.message.includes(error), 'Error message is incorrect')
  } else if (error instanceof RegExp) {
    assert(
      error.test(result.message),
      `Expected ${result.message} to match ${error}`,
    )
  } else {
    invariant(
      typeof error === 'boolean',
      'The given `error` must be a function, string, boolean, or RegExp',
    )
  }
}