// IsValid for patterns checks each pattern and returns if a match has
// been found
321858
func (p patterns) IsValid(value string) bool {
	for _, pattern := range p {
		if strings.HasPrefix(http.CanonicalHeaderKey(value), pattern) {
			return true
		}
	}
	return false
}
555407
func (c *cache) isValid(services []*registry.Service, ttl time.Time) bool {
	// no services exist
	if len(services) == 0 {
		return false
	}

	// ttl is invalid
	if ttl.IsZero() {
		return false
	}

	// time since ttl is longer than timeout
	if time.Since(ttl) > c.opts.TTL {
		return false
	}

	// ok
	return true
}
884291
func isValid(cur_person Person, other_person Person, check_pairing bool) bool {
	if other_person.Id == cur_person.Id {
		dbg.Printf("  same person %v\n", other_person)
		return false
	}

	if pairedTooRecently(cur_person, other_person) {
		dbg.Printf("  too recent %v\n", other_person)
		return false
	}

	return true
}
648122
func (c *Company) IsValid() (valid bool) {
	valid = true
	globalIDLength := len(c.Globalid)
	valid = valid && (globalIDLength >= 3) && (globalIDLength <= 150) && c.Globalid == strings.ToLower(c.Globalid)
	return
}
596441
func (a *App) IsValid() error {
	if !NamePattern.Match([]byte(a.Name)) {
		return ErrInvalidName
	}

	return nil
}
1283941
func IsValid(uuid string) bool {
	_, err := Parse(uuid)
	return err == nil
}
385693
func (h hashPrefix) IsValid() bool {
	return len(h) >= minHashPrefixLength && len(h) <= maxHashPrefixLength
}
241335
func (po *Po) isValidLine(l string) bool {
	// Check prefix
	valid := []string{
		"\"",
		"msgctxt",
		"msgid",
		"msgid_plural",
		"msgstr",
	}

	for _, v := range valid {
		if strings.HasPrefix(l, v) {
			return true
		}
	}

	return false
}
258838
func (s SortOpt) IsValid() bool {
	switch s {
	case "", ByCid, ByStart, BySubs, ByPending, ByOutMsgs, ByInMsgs, ByOutBytes, ByInBytes, ByLast, ByIdle, ByUptime, ByStop, ByReason:
		return true
	default:
		return false
	}
}
249767
func isPattern(generator string) bool {
	for _, ptn := range PATTERNS {
		if ptn == generator {
			return true
		}
	}
	return false
}
977294
func (ls *LocalStore) isValid(chunk Chunk) bool {
	// by default chunks are valid. if we have 0 validators, then all chunks are valid.
	valid := true

	// ls.Validators contains a list of one validator per chunk type.
	// if one validator succeeds, then the chunk is valid
	for _, v := range ls.Validators {
		if valid = v.Validate(chunk); valid {
			break
		}
	}
	return valid
}
926475
func (e *Element) IsInvalid() bool {
	e.lock.RLock()
	defer e.lock.RUnlock()
	return e.invalidated
}
1036349
func (jfo *JobFindOptions) IsValid() bool {
	s := structs.New(jfo)
	f := s.Fields()

	nonZeroValues := 0

	for _, field := range f {
		if !field.IsZero() {
			nonZeroValues += 1
		}
	}

	return nonZeroValues == 0 || nonZeroValues == 1
}
1224366
func IsStringMatches(s string, params ...string) bool {
	if len(params) == 1 {
		pattern := params[0]
		return IsMatches(s, pattern)
	}
	return false
}
1187585
func (r inclusiveRules) IsValid(value string) bool {
	for _, rule := range r {
		if !rule.IsValid(value) {
			return false
		}
	}
	return true
}
1344244
func (cred Credentials) IsValid() bool {
	// Verify credentials if its enabled or not set.
	if cred.Status == "enabled" || cred.Status == "" {
		return IsAccessKeyValid(cred.AccessKey) && IsSecretKeyValid(cred.SecretKey) && !cred.IsExpired()
	}
	return false
}
89281
func IsInvalidAction(err error) bool {
	if err == ErrInvalidAction {
		return true
	}
	de, ok := err.(*DeltaError)
	return ok && de.Err == ErrInvalidAction
}