Repository: AlecAivazis/survey (go)

Issue:
Rename `Select.FilterFn` to `Select.Filter`

Pull request:
Renamed *.FIlterFn to Filter
This PR fixes #200.

Patch:
diff --git a/README.md b/README.md
index 4f33b90..55a471f 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,7 @@
 
 A library for building interactive prompts.
 
+
 <img width="550" src="https://thumbs.gfycat.com/VillainousGraciousKouprey-size_restricted.gif"/>
 
 ```go
@@ -56,6 +57,9 @@ func main() {
 }
 ```
 
+*NOTE*: This page describes the API for the upcoming `v2` release which has not been made available yet. For documentation
+for the old `v1` version, see [here](https://godoc.org/gopkg.in/AlecAivazis/survey.v1).
+
 ## Table of Contents
 
 1. [Examples](#examples)
@@ -195,17 +199,16 @@ the result. If neither of those are present, notepad (on Windows) or vim (Linux
 ## Filtering options in Select and MultiSelect
 
 The user can filter for options by typing while the prompt is active. This will filter out all options that don't contain the
-typed string anywhere in their name, ignoring case. This default filtering behavior is provided by the `DefaultFilterFn`
-function.
+typed string anywhere in their name, ignoring case. This default filtering behavior is provided by the `DefaultFilter` function.
 
-A custom filter function can also be provided to change this default behavior by providing a value for the `FilterFn` field:
+A custom filter function can also be provided to change this default behavior by providing a value for the `Filter` field:
 
 ```golang
 &Select{
     Message: "Choose a color:",
     Options: []string{"red", "blue", "green"},
-    FilterFn: func(filter string, options []string) (filtered []string) {
-        result := DefaultFilterFn(filter, options)
+    Filter: func(filter string, options []string) (filtered []string) {
+        result := DefaultFilter(filter, options)
         for _, v := range result {
             if len(v) >= 5 {
                 filtered = append(filtered, v)
diff --git a/filter.go b/filter.go
index 6900719..073d5d0 100644
--- a/filter.go
+++ b/filter.go
@@ -2,7 +2,7 @@ package survey
 
 import "strings"
 
-var DefaultFilterFn = func(filter string, options []string) (answer []string) {
+var DefaultFilter = func(filter string, options []string) (answer []string) {
 	filter = strings.ToLower(filter)
 	for _, o := range options {
 		if strings.Contains(strings.ToLower(o), filter) {
diff --git a/multiselect.go b/multiselect.go
index e55aefd..5045d24 100644
--- a/multiselect.go
+++ b/multiselect.go
@@ -28,7 +28,7 @@ type MultiSelect struct {
 	PageSize      int
 	VimMode       bool
 	FilterMessage string
-	FilterFn      func(string, []string) []string
+	Filter        func(string, []string) []string
 	filter        string
 	selectedIndex int
 	checked       map[string]bool
@@ -150,10 +150,10 @@ func (m *MultiSelect) filterOptions() []string {
 	if m.filter == "" {
 		return m.Options
 	}
-	if m.FilterFn != nil {
-		return m.FilterFn(m.filter, m.Options)
+	if m.Filter != nil {
+		return m.Filter(m.filter, m.Options)
 	}
-	return DefaultFilterFn(m.filter, m.Options)
+	return DefaultFilter(m.filter, m.Options)
 }
 
 func (m *MultiSelect) Prompt() (interface{}, error) {
diff --git a/select.go b/select.go
index a621d10..791784e 100644
--- a/select.go
+++ b/select.go
@@ -27,7 +27,7 @@ type Select struct {
 	PageSize      int
 	VimMode       bool
 	FilterMessage string
-	FilterFn      func(string, []string) []string
+	Filter        func(string, []string) []string
 	filter        string
 	selectedIndex int
 	useDefault    bool
@@ -158,10 +158,10 @@ func (s *Select) filterOptions() []string {
 	if s.filter == "" {
 		return s.Options
 	}
-	if s.FilterFn != nil {
-		return s.FilterFn(s.filter, s.Options)
+	if s.Filter != nil {
+		return s.Filter(s.filter, s.Options)
 	}
-	return DefaultFilterFn(s.filter, s.Options)
+	return DefaultFilter(s.filter, s.Options)
 }
 
 func (s *Select) Prompt() (interface{}, error) {


Test patch:
diff --git a/multiselect_test.go b/multiselect_test.go
index b0ede84..f0cedb1 100644
--- a/multiselect_test.go
+++ b/multiselect_test.go
@@ -268,8 +268,8 @@ func TestMultiSelectPrompt(t *testing.T) {
 			&MultiSelect{
 				Message: "What days do you prefer:",
 				Options: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
-				FilterFn: func(filter string, options []string) (filtered []string) {
-					result := DefaultFilterFn(filter, options)
+				Filter: func(filter string, options []string) (filtered []string) {
+					result := DefaultFilter(filter, options)
 					for _, v := range result {
 						if len(v) >= 7 {
 							filtered = append(filtered, v)
diff --git a/select_test.go b/select_test.go
index 539a85e..c16d193 100644
--- a/select_test.go
+++ b/select_test.go
@@ -256,8 +256,8 @@ func TestSelectPrompt(t *testing.T) {
 			&Select{
 				Message: "Choose a color:",
 				Options: []string{"red", "blue", "green"},
-				FilterFn: func(filter string, options []string) (filtered []string) {
-					result := DefaultFilterFn(filter, options)
+				Filter: func(filter string, options []string) (filtered []string) {
+					result := DefaultFilter(filter, options)
 					for _, v := range result {
 						if len(v) >= 5 {
 							filtered = append(filtered, v)