picomatch
picomatch copied to clipboard
Different behavior of scan method depending on options
Description
The scan
method returns different parts
depending on options.
- When the
parts
option is passed, then*/c
will be represented as two parts of the pattern (['*', 'c']
). - When the
tokens
option is passed, the*/c
will be represented as one part of the pattern (['*/c']
).
The documentation says that the tokens
option automatically enables the parts
option. Based on this, i expect the behavior to be same when I pass the parts
option manually.
parts
This is automatically enabled whenoptions.tokens
istrue
.
Code
const mm = require('micromatch');
const a = mm.scan('a/b/*/c', { parts: true });
console.dir(a.parts, { colors: true });
// [ 'a', 'b', '*', 'c' ]
const b = mm.scan('a/b/*/c', { tokens: true });
console.dir(b.parts, { colors: true });
// [ 'a', 'b', '*/c' ]
Based on this, i expect the behavior to be same when I pass the
parts
option manually.
agreed, that's a bug. I think I might have fixed this already, I'm traveling this weekend. I'll push up a fix ASAP.