Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly support wildcard when not in a section of its own #11

Merged
merged 2 commits into from
Jan 7, 2019

Conversation

DamonOehlman
Copy link
Owner

This PR addresses the issue raised and discussed in #8 whereby a string such as *foo wouldn't match string foo. This wasn't the goal of the library as it was only built to mimic the behaviour of the wildcard usage within eve. However, it is completely legitimate given the name of the package and the contexts that people would expect it to work in.

NOTE: ES5 code style maintained for compatibility with older browsers, and well why rewrite for the sake of it.

@revelt @bradennapier A quick review would be appreciated. I think using matcher is the correct path forward for most people and I that as an alternative on the README, but think getting this package right is probably worthwhile also.

@@ -35,9 +37,9 @@

function WildcardMatcher(text, separator) {
this.text = text = text || '';
this.hasWild = ~text.indexOf('*');
this.hasWild = text.indexOf('*') >= 0;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of ~ was just trying to be clever. Replaced with something sensible.

@DamonOehlman DamonOehlman merged commit 4797dae into master Jan 7, 2019
@DamonOehlman DamonOehlman deleted the damon-leading-wildcard branch January 7, 2019 06:32
@revelt
Copy link

revelt commented Jan 7, 2019

Good stuff! +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants