Skip to content

Commit

Permalink
bugfix: user input was interpreted as a regular expression
Browse files Browse the repository at this point in the history
It would crash if the input was an invalid regular expression, like 'aaa['.
It would match everything if the input was '..' or '.*'.
Now it's interpreting the input as a string.
  • Loading branch information
not-raspberry committed Nov 26, 2015
1 parent f6d9573 commit c33ab97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/reactTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var ReactTags = React.createClass({

var query = e.target.value.trim();
var suggestions = this.props.suggestions.filter(function(item) {
return (item.toLowerCase()).search(query.toLowerCase()) === 0;
return item.toLowerCase().startsWith(query.toLowerCase());
});

this.setState({
Expand Down

0 comments on commit c33ab97

Please sign in to comment.