Skip to content

Commit

Permalink
fixing the toLowerCase error
Browse files Browse the repository at this point in the history
  • Loading branch information
tavareshenrique authored and gwyneplaine committed Jan 3, 2019
1 parent 2ce511a commit d2806cc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Creatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ export type CreatableProps = {

export type Props = SelectProps & CreatableProps;

const compareOption = (inputValue, option) => {
const candidate = inputValue.toLowerCase();
return (
option.value.toLowerCase() === candidate ||
option.label.toLowerCase() === candidate
);
const compareOption = (inputValue = '', option) => {
const candidate = String(inputValue).toLowerCase();
const optionValue = String(option.value).toLowerCase();
const optionLabel = String(option.label).toLowerCase();
return optionValue === candidate || optionLabel === candidate;
};

const builtins = {
Expand Down

0 comments on commit d2806cc

Please sign in to comment.