-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
The scan method returns empty parts for pattern with only a forward slash #58
Comments
Similar behaviour for the following patterns: pm.scan('/a', { parts: true }).parts → []
pm.scan('/a/b', { parts: true }).parts → [ '/a', 'b' ]
pm.scan('(!(b/a))', { parts: true }).parts → [] |
thanks for the issue, I'm working on it. This feedback helps. |
@mrmlnc here is what I'd expect for these patterns: pm.scan('/', { parts: true }).parts → ['', '']
pm.scan('/a', { parts: true }).parts → ['', 'a']
pm.scan('/a/b', { parts: true }).parts → ['', 'a', 'b']
pm.scan('(!(b/a))', { parts: true }).parts → [''] I'll need to think more about the last pattern. I assume the goal is probably to create matchers for each section of a glob pattern so that you can limit Edit: I have a patch ready to push up once we come to consensus on what the results should be. |
IMHO, the I correctly understand that the |
yes, that's correct.
For the pattern |
Yeah, you're quite right there. I didn't think that only one segment of the pattern should be matched to all parts of the path. |
I think I have this working. I'm adding some unit tests to see if I can kill more edge cases before I push up. Please let me know if you come up with any patterns that you think are tricky and you want me to test. thx |
Another case is
I expect that Source: mrmlnc/fast-glob#263 |
Thank you for the additional test case. However, do you mean that Thoughts? |
Oh, nevermind, I completely missed the fact that there was a slash in that segment. |
Environment
picomatch@master
Code sample
Expected behaviour
I expect to see a representation of the pattern with each of its segments. Without empty parts of the pattern, we will not be able to apply it correctly.
For example, the current pattern must be matched only for
/
(left side —<empty>
, right side —<empty>
).Actual behaviour
The text was updated successfully, but these errors were encountered: