Git Product home page Git Product logo

Comments (7)

es128 avatar es128 commented on May 27, 2024

I can't speak to why both needed to be provided in the API, but here's the difference as far as I can tell:

filter works with one or more glob patterns.

matcher works with one criterion (not an array) and allows regexes and functions as well as glob patterns as the input.

from micromatch.

jonschlinkert avatar jonschlinkert commented on May 27, 2024

Yeah, the differences that @es128 pointed out are correct, but I've thought about removing filter. Maybe we can allow matcher to handle multiple patterns, and get rid of filter next time we make major changes

from micromatch.

callumlocke avatar callumlocke commented on May 27, 2024

Maybe we can allow matcher to handle multiple patterns, and get rid of filter next time we make major changes

That sounds good, less confusing.

In the mean time, do I understand correctly that mm.filter(x)(filename) should always work identically to mm(filenames, x), no matter what type x is?

from micromatch.

jonschlinkert avatar jonschlinkert commented on May 27, 2024

What's the use case? might be easier to give good feedback based on what you're trying to accomplish.

from micromatch.

callumlocke avatar callumlocke commented on May 27, 2024

The mm() function works like this:

Negation patterns:
Behavior;

  • when the pattern is a string, minimatch behavior is used, so patterns are inclusive by default.
  • when an array of patterns is passed, multimatch behavior is used, so patterns are exclusive by default

Does the function I get back from mm.filter(x) have that same behaviour (i.e. it can either be inclusive or exclusive, depending on whether x is an array or a string)?

from micromatch.

jonschlinkert avatar jonschlinkert commented on May 27, 2024

can [filter] either be inclusive or exclusive, depending on whether x is an array or a string)?

it should, yes. see these unit tests for examples

from micromatch.

jonschlinkert avatar jonschlinkert commented on May 27, 2024

closing since it's not technically an issue. feel free to continue the conversation or open a new issue if a new topic pops up

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.