-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Throw on invalid glob, clean up, 100% coverage, closes #34 #35
Conversation
Shiny 100% 😺 |
return false; | ||
if (pattern instanceof RegExp) return true; | ||
if (typeof pattern === 'string') return pattern[0] === '!'; | ||
throw new Error('Invalid glob argument'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should emit the glob index that was invalid. I think this validation belongs at the top of the main globs loop not in a sub-function
Thinking again, the |
- Better naming for negative matchers ( gulpjs#33 (comment) ) - Throw on invalid glob argument ( gulpjs#34 (comment) ) - Removed the `if (!Array.isArray(globs)) return gs.createStream(globs, [], opt);` because this optimization is already covered a couple lines below at `if (positives.length === 1) return streamFromPositive(positives[0]);`, and to not duplicate the validation code. Previously, passing a string with a negative glob did not throw a "Missing positive glob" error, now it does.
PTAL. |
Nice and clean now - thanks! |
Throw on invalid glob, clean up, 100% coverage, closes #34
Throw on invalid glob, clean up, 100% coverage, closes #34
Throw on invalid glob, clean up, 100% coverage, closes #34
if (!Array.isArray(globs)) return gs.createStream(globs, [], opt);
because this optimization is already covered a couple lines below atif (positives.length === 1) return streamFromPositive(positives[0]);
, and to not duplicate the validation code. Previously, passing a string with a negative glob did not throw a "Missing positive glob" error, now it does.