2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-22 10:30:34 +03:00

rename filterMatch to filterBy

This commit is contained in:
Jeff
2018-01-12 22:53:13 -08:00
parent f530ab952b
commit 2cffee27f6
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -585,7 +585,7 @@
* @param {String} search * @param {String} search
* @return {Boolean} * @return {Boolean}
*/ */
filterMatch: { filterBy: {
type: Function, type: Function,
default(option, label, search) { default(option, label, search) {
return (label || '').toLowerCase().indexOf(search.toLowerCase()) > -1 return (label || '').toLowerCase().indexOf(search.toLowerCase()) > -1
@@ -596,7 +596,7 @@
* Callback to filter results when search text * Callback to filter results when search text
* is provided. Default implementation loops * is provided. Default implementation loops
* each option, and returns the result of * each option, and returns the result of
* this.filterMatch. * this.filterBy.
* @type {Function} * @type {Function}
* @param {Array} list of options * @param {Array} list of options
* @param {String} search text * @param {String} search text
@@ -611,7 +611,7 @@
if (typeof label === 'number') { if (typeof label === 'number') {
label = label.toString() label = label.toString()
} }
return this.filterMatch(option, label, search) return this.filterBy(option, label, search)
}); });
} }
}, },
+1 -1
View File
@@ -324,7 +324,7 @@ describe('Select.vue', () => {
it('can determine if a given option should match the current search text', () => { it('can determine if a given option should match the current search text', () => {
const vm = new Vue({ const vm = new Vue({
template: `<div><v-select ref="select" :filter-match="customFn" :options="[{label: 'Aoo', value: 'foo'}, {label: 'Bar', value: 'bar'}, {label: 'Baz', value: 'baz'}]" v-model="value"></v-select></div>`, template: `<div><v-select ref="select" :filter-by="customFn" :options="[{label: 'Aoo', value: 'foo'}, {label: 'Bar', value: 'bar'}, {label: 'Baz', value: 'baz'}]" v-model="value"></v-select></div>`,
data: {value: 'foo'}, data: {value: 'foo'},
methods:{ methods:{
customFn: (option, label, search) => label.match(new RegExp('^' + search, 'i')) customFn: (option, label, search) => label.match(new RegExp('^' + search, 'i'))