Skip to content

Commit

Permalink
Remove unnecessary method
Browse files Browse the repository at this point in the history
  • Loading branch information
tgolen committed Dec 7, 2022
1 parent 646bb44 commit 59fe70d
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class IOUCurrencySelection extends Component {

this.state = {
searchValue: '',
currencyData: this.getFilteredCurrencyList(),
currencyData: this.getCurrencyOptions(this.props.currencyList),
};
this.getCurrencyOptions = this.getCurrencyOptions.bind(this);
this.getSections = this.getSections.bind(this);
Expand Down Expand Up @@ -82,24 +82,19 @@ class IOUCurrencySelection extends Component {
}));
}

getFilteredCurrencyList(searchValue = '') {
const currencyOptions = this.getCurrencyOptions(this.props.currencyList);
if (!searchValue) {
return currencyOptions;
}
const searchRegex = new RegExp(searchValue, 'i');
return _.filter(currencyOptions, currencyOption => searchRegex.test(currencyOption.text));
}

/**
* Sets new search value
* @param {String} searchValue
* @return {void}
*/
changeSearchValue(searchValue) {
const currencyOptions = this.getCurrencyOptions(this.props.currencyList);
const searchRegex = new RegExp(searchValue, 'i');
const filteredCurrencies = _.filter(currencyOptions, currencyOption => searchRegex.test(currencyOption.text));

this.setState({
searchValue,
currencyData: this.getFilteredCurrencyList(searchValue),
currencyData: filteredCurrencies,
});
}

Expand Down

0 comments on commit 59fe70d

Please sign in to comment.