@@ -91,10 +91,12 @@ func (p *PathList) FilterOutHiddenFiles() {
9191 p .FilterOutPrefix ("." )
9292}
9393
94- func (p * PathList ) filter (filter func (* Path ) bool ) {
94+ // Filter will remove all the elements of the list that do not match
95+ // the specified acceptor function
96+ func (p * PathList ) Filter (acceptorFunc func (* Path ) bool ) {
9597 res := (* p )[:0 ]
9698 for _ , path := range * p {
97- if filter (path ) {
99+ if acceptorFunc (path ) {
98100 res = append (res , path )
99101 }
100102 }
@@ -106,31 +108,31 @@ func (p *PathList) FilterOutPrefix(prefixes ...string) {
106108 filterFunction := func (path * Path ) bool {
107109 return ! path .HasPrefix (prefixes ... )
108110 }
109- p .filter (filterFunction )
111+ p .Filter (filterFunction )
110112}
111113
112114// FilterPrefix remove all entries not having one of the specified prefixes
113115func (p * PathList ) FilterPrefix (prefixes ... string ) {
114116 filterFunction := func (path * Path ) bool {
115117 return path .HasPrefix (prefixes ... )
116118 }
117- p .filter (filterFunction )
119+ p .Filter (filterFunction )
118120}
119121
120122// FilterOutSuffix remove all entries having one of the specified suffixes
121123func (p * PathList ) FilterOutSuffix (suffixies ... string ) {
122124 filterFunction := func (path * Path ) bool {
123125 return ! path .HasSuffix (suffixies ... )
124126 }
125- p .filter (filterFunction )
127+ p .Filter (filterFunction )
126128}
127129
128130// FilterSuffix remove all entries not having one of the specified suffixes
129131func (p * PathList ) FilterSuffix (suffixies ... string ) {
130132 filterFunction := func (path * Path ) bool {
131133 return path .HasSuffix (suffixies ... )
132134 }
133- p .filter (filterFunction )
135+ p .Filter (filterFunction )
134136}
135137
136138// Add adds a Path to the PathList
0 commit comments