// In matcher, checks if the given field matches one of the value of the given slice.
// v must be a slice.
14400
func In(field string, v interface{}) Matcher {
	return NewFieldMatcher(field, &in{list: v})
}
454146
func (v *Validator) Match(field string, regex *regexp.Regexp) *ValidationResult {
	if !regex.MatchString(v.data.Get(field)) {
		return v.addMatchError(field)
	} else {
		return validationOk
	}
}
1165213
func (m requestMatchers) Match(r *http.Request) bool {
	for _, matcher := range m {
		if !matcher.Match(r) {
			return false
		}
	}
	return true
}
1008294
func (m *matcher) match(line string) *Template {
	tmpl := m.root.search(line)
	if tmpl != nil {
		return tmpl
	}
	return m.defaultTemplate
}
1325711
func containsValue(m map[string]string, val string) bool {
	for _, v := range m {
		if v == val {
			return true
		}
	}
	return false
}
601036
func NewStringMatcher(dictionary []string) *Matcher {
	m := new(Matcher)

	var d [][]byte
	for _, s := range dictionary {
		d = append(d, []byte(s))
	}

	m.buildTrie(d)

	return m
}
878637
func containsValuer(keyvals []interface{}) bool {
	for i := 1; i < len(keyvals); i += 2 {
		if _, ok := keyvals[i].(Valuer); ok {
			return true
		}
	}
	return false
}
736573
func (pg *GoEvtxMap) RegexMatch(path *GoEvtxPath, pattern *regexp.Regexp) bool {
	s, err := pg.GetString(path)
	if err != nil {
		return false
	}
	return pattern.MatchString(s)
}
160730
func (args Args) MatchKVList(key string, sources map[string]string) bool {
	fieldValues := args.fields[key]

	//do not filter if there is no filter set or cannot determine filter
	if len(fieldValues) == 0 {
		return true
	}

	if len(sources) == 0 {
		return false
	}

	for value := range fieldValues {
		testKV := strings.SplitN(value, "=", 2)

		v, ok := sources[testKV[0]]
		if !ok {
			return false
		}
		if len(testKV) == 2 && testKV[1] != v {
			return false
		}
	}

	return true
}
1366922
func (l *Levenshtein) IsMatch(s int) bool {
	if s < len(l.dfa.states) {
		return l.dfa.states[s].match
	}
	return false
}
350738
func sliceTypeCheck(t Type, val reflect.Value) error {
	if val.Kind() != reflect.Slice && val.Kind() != reflect.Array {
		return typeErr(formatSliceString(t.Kind, t.Size), val.Type())
	}

	if t.T == ArrayTy && val.Len() != t.Size {
		return typeErr(formatSliceString(t.Elem.Kind, t.Size), formatSliceString(val.Type().Elem().Kind(), val.Len()))
	}

	if t.Elem.T == SliceTy {
		if val.Len() > 0 {
			return sliceTypeCheck(*t.Elem, val.Index(0))
		}
	} else if t.Elem.T == ArrayTy {
		return sliceTypeCheck(*t.Elem, val.Index(0))
	}

	if elemKind := val.Type().Elem().Kind(); elemKind != t.Elem.Kind {
		return typeErr(formatSliceString(t.Elem.Kind, t.Size), val.Type())
	}
	return nil
}
27697
func SliceContainsString(slice []string, str string) bool {
	for _, value := range slice {
		if value == str {
			return true
		}
	}
	return false
}
675168
func Matcher(p rpc.ReadPeeker) bool {
	b, err := p.Peek(1)
	return err == nil && b[0] == '{'
}
569607
func matchSingleLiteral(expr syntax.Expr) interface{} {
	if literal, ok := expr.(*syntax.Literal); ok {
		return literal.Value
	}
	return nil
}
877546
func Match(buf []byte) (types.Type, error) {
	length := len(buf)
	if length == 0 {
		return types.Unknown, ErrEmptyBuffer
	}

	for _, kind := range *MatcherKeys {
		checker := Matchers[kind]
		match := checker(buf)
		if match != types.Unknown && match.Extension != "" {
			return match, nil
		}
	}

	return types.Unknown, nil
}
1154398
func (fn typeFunc) Matches(types []reflect.Type) bool {
	if len(fn.Extra) != len(types) {
		return false
	}
	// reorder the items in array types and fn.Extra
	// convert the type into string and sort them, check if they are matched
	varMap := make(map[reflect.Type]bool)
	for i := range fn.Extra {
		varMap[fn.Extra[i]] = true
	}
	for i := range types {
		if _, found := varMap[types[i]]; !found {
			return false
		}
	}
	return true
}
1274097
func (c *Clause) MatchesKeyword(peekWord string, l *Lexer) bool {
	if c.KeywordMatcher != nil {
		return c.KeywordMatcher(c, peekWord, l)
	} else if c.keyword == peekWord && !c.multiWord {
		return true
	} else if c.multiWord {
		if strings.ToLower(l.PeekX(len(c.fullWord))) == c.fullWord {
			return true
		}
	}
	return false
}