Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_handleFilterChange = (value) => {
let filterType;
switch (value) { // eslint-disable-line default-case
case 'case':
filterType = Autocomplete.caseInsensitiveFilter;
break;
case 'fuzzy':
filterType = Autocomplete.fuzzyFilter;
break;
case 'fuse':
filterType = this._fuseJSFilter;
break;
}
this.setState({ filterType });
};
constructor(props) {
super(props);
this.state = {
filterType: Autocomplete.caseInsensitiveFilter,
};
}
constructor(props) {
super(props);
this.state = {
filterType: Autocomplete.caseInsensitiveFilter,
};
this.indexer = new Fuse(sampleData.map(lang => ({ primaryText: lang })), {
keys: [{ name: 'primaryText', weight: 1 }],
});
}
handleChange = (value) => {
let { filterType } = this.state;
switch (value) {
case controls[0].value:
filterType = Autocomplete.caseInsensitiveFilter;
break;
case controls[1].value:
filterType = Autocomplete.fuzzyFilter;
break;
case controls[2].value:
filterType = this.filterWithFuseJS;
break;
default:
filterType = Autocomplete.caseInsensitiveFilter;
}
if (this.state.filterType !== filterType) {
this.setState({ filterType });
}
};