Skip to content

Commit

Permalink
changed a few functions definitions to use expressions instead of return
Browse files Browse the repository at this point in the history
  • Loading branch information
gsidebo committed Jun 29, 2016
1 parent 5af8572 commit dce4fe6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions static/js/components/inputs/SelectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ class SelectField extends React.Component {
let filterFunction = _.has(autocompleteProps, 'filter') ?
autocompleteProps.filter :
AutoCompleteSettings.defaultFilter;
let firstMatchingOption = _.find(options, (option) => {
return filterFunction(optionOrString, option.label);
});
let firstMatchingOption = options.find((option) => filterFunction(optionOrString, option.label));
if (firstMatchingOption) {
toStore = firstMatchingOption.value;
}
Expand Down
16 changes: 8 additions & 8 deletions static/js/components/utils/AutoCompleteSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ AutoCompleteSettings.fuzzyFilter = (searchText, key) => {
return searchTextIndex === searchText.length;
};

AutoCompleteSettings.defaultMenuItemRender = (settings, option) => { // eslint-disable-line react/display-name
return <MenuItem
AutoCompleteSettings.defaultMenuItemRender = (settings, option) => ( // eslint-disable-line react/display-name
<MenuItem
key={option.value}
primaryText={option.label}
value={option.value}
{...settings.props}
/>;
};
/>
);

const renderHighlightedOption = (optionLabel, searchText) => {
let searchTextIndex = optionLabel.toLowerCase().indexOf(searchText.toLowerCase());
Expand All @@ -88,15 +88,15 @@ const renderHighlightedOption = (optionLabel, searchText) => {
return <span>{optionLabel}</span>;
}
};
AutoCompleteSettings.highlightedMenuItemRender = (settings, option) => { // eslint-disable-line react/display-name
return <MenuItem
AutoCompleteSettings.highlightedMenuItemRender = (settings, option) => ( // eslint-disable-line react/display-name
<MenuItem
key={option.value}
value={option.value}
{...settings.props}
>
{ renderHighlightedOption(option.label, settings.searchText) }
</MenuItem>;
};
</MenuItem>
);

AutoCompleteSettings.showAllOptions = (props) => {
const { filter } = props;
Expand Down

0 comments on commit dce4fe6

Please sign in to comment.