Git Product home page Git Product logo

Comments (13)

MartinKolarik avatar MartinKolarik commented on June 6, 2024 1

console.log(mm.isMatch('a/b/c/d', 'a/**b')) // => false

It does if you fix the pattern: console.log(mm.isMatch('a/b/c/d', 'a/**d')); // => true

from micromatch.

jonschlinkert avatar jonschlinkert commented on June 6, 2024 1

Hmm, okay. I remember implementing behavior based on my (literal) interpretation of the spec. But it seems this is a bit nuanced.

fwiw I'm refactoring this to use a parser like the one implemented in the refactor branch of extglob. this will allow us to easily make changes based on discussions like this

from micromatch.

jonschlinkert avatar jonschlinkert commented on June 6, 2024

Is this intentional?

No, it's not. I'll look into it, thx

from micromatch.

tunnckoCore avatar tunnckoCore commented on June 6, 2024

@MartinKolarik returns true (maybe a bug?)

I don't think so. It's not a bug for me.

No, it's not.

@jonschlinkert @MartinKolarik, actually it is logical to be true because * means 0 or more. And no matter that it is globstar not single star, it still make sense.

from micromatch.

MartinKolarik avatar MartinKolarik commented on June 6, 2024

@tunnckoCore it would make sense for mm.isMatch('a/b', 'a/**b');, but it shouldn't behave like globstar (matching multiple dirs) if it isn't the only thing in a path part.

from micromatch.

tunnckoCore avatar tunnckoCore commented on June 6, 2024

I'm not saying it should behave like globstar. I'm not sure for the my last sentence, just saying it make some sense.

And not, it not behaves as globstar, which is good and expected?

console.log(mm.isMatch('a/b/c/d', 'a/**b')) // => false

from micromatch.

jonschlinkert avatar jonschlinkert commented on June 6, 2024

The current behavior is correct. From the bash specification

two adjacent ‘’s used as a single pattern will match all files and zero or more directories and subdirectories. If followed by a ‘/’, two adjacent ‘’s will match only directories and subdirectories.

closing

from micromatch.

MartinKolarik avatar MartinKolarik commented on June 6, 2024

Well, the linked spec also doesn't say mm.isMatch('a/b/c', 'a/b**'); shouldn't match, but it (I think correctly) doesn't. I wasn't able to find a spec covering this behavior, but it's documented in minimatch's README, and more importantly, it's how real bash works (just tested that).

from micromatch.

MartinKolarik avatar MartinKolarik commented on June 6, 2024

fwiw I'm refactoring this to use a parser like the one implemented in the refactor branch of extglob.

Looks good, that should definitely make it easier to handle situations like this.

from micromatch.

jonschlinkert avatar jonschlinkert commented on June 6, 2024

indeed, but the best part is that it's also much faster :)

from micromatch.

MartinKolarik avatar MartinKolarik commented on June 6, 2024

Really? It already is quite fast. Will definitely take a closer look at the code.

from micromatch.

jonschlinkert avatar jonschlinkert commented on June 6, 2024

more specifically it parses and compiles the regex patterns faster. so initialization will be faster, but not necessarily the actual matching. Hmm, I'm going to create an issue to get my thoughts out on this

from micromatch.

MartinKolarik avatar MartinKolarik commented on June 6, 2024

more specifically it parses and compiles the regex patterns faster. so initialization will be faster, but not necessarily the actual matching

yeah that makes sense

from micromatch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.