terkelg / tiny-glob

Super tiny and ~350% faster alternative to node-glob
MIT License
856 stars 25 forks source link

Support for double asterisk matches ** like bash globbing #85

Open ssbarnea opened 2 years ago

ssbarnea commented 2 years ago

It is not clear from the REAME if this library supports ** in matching patterns. That feature is extremely important for some use cases because foo/*/*.yml is expected to match only one folder deep, while using foo/**/*.yml is expected to go recursively.

Basically ** includes the directory separator while simple one does not. Is this supported? If not it should be stated as it one of the most popular globbing features.

Apparently https://github.com/microsoft/vscode-json-languageservice/blob/main/src/utils/glob.ts implementations supports that.

Reference: https://stackoverflow.com/questions/32604656/what-is-the-glob-character

Krinkle commented 2 years ago

I use this library for qunit, in both source and tests, with the ** pattern (sometimes known as a "globstar"). Downstream we integrate with Node.js 10+ on Linux, macOS and Windows.

The following tests show how the feature works. Do one of the cases resemble what you're looking for? https://github.com/terkelg/tiny-glob/blob/v0.2.9/test/glob.js#L58-L74