picomatch icon indicating copy to clipboard operation
picomatch copied to clipboard

TypeError when searching for prototype Object method

Open adiktofsugar opened this issue 4 years ago • 0 comments

If you search for one of the protoype Object methods or properties, it'll throw an error because of an optimization in parse:

input = REPLACEMENTS[input] || input;

Sample code:

> const pm = require('picomatch')
> pm('toString')
Thrown:
TypeError: output.startsWith is not a function
    at Object.exports.removePrefix (/path/to/node_modules/picomatch/lib/utils.js:48:14)
    at parse (/path/to/node_modules/picomatch/lib/parse.js:130:17)
    at Function.picomatch.makeRe (/path/to/node_modules/picomatch/lib/picomatch.js:291:14)
    at picomatch (/path/to/node_modules/picomatch/lib/picomatch.js:55:17)

adiktofsugar avatar Apr 07 '20 00:04 adiktofsugar