github.com/blend/go-sdk@v1.20220411.3/profanity/contains_filter.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package profanity
     9  
    10  import "strings"
    11  
    12  // ContainsFilter is the contains filter.
    13  type ContainsFilter struct {
    14  	Filter `yaml:",inline"`
    15  }
    16  
    17  // Match applies the filter.
    18  func (c ContainsFilter) Match(value string) (includeMatch, excludeMatch string) {
    19  	return c.Filter.Match(value, strings.Contains)
    20  }
    21  
    22  // Allow returns if apply returns a result.
    23  func (c ContainsFilter) Allow(value string) bool {
    24  	return c.Filter.Allow(value, strings.Contains)
    25  }