Giter VIP home page Giter VIP logo

Comments (12)

blakeembrey avatar blakeembrey commented on July 24, 2024

@jonathanong How about adding support for various regexp-style modifiers (+ for more than one part, * for zero or more and ? for optional)? The plus style sounds like what you're after here.

from path-to-regexp.

jonathanong avatar jonathanong commented on July 24, 2024

oh that makes sense. i think of * as just "anything, i don't care" not a regexp wildcard when defining routes though.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

In my refactor I removed the ability to use an asterisk like that in favour of just using a regexp - (.*) - since that was what it did anyway internally.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

Anyway, if you're on board with it - I can add the ability tonight and get everything tested.

from path-to-regexp.

jonathanong avatar jonathanong commented on July 24, 2024

i thought (.*) just checked the current fragment. i'd like file to be something like lib/index.js or something.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

Well, * was always replaced with (.*) - there was never any understanding of fragments. If you wanted file to match that, you could use /:file(.+) or with this change /:file+.

from path-to-regexp.

jonathanong avatar jonathanong commented on July 24, 2024

ohhhh this changes everything!

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

Haha, is that good or bad?

from path-to-regexp.

jonathanong avatar jonathanong commented on July 24, 2024

good. if that's the case, we might as well remove * support outside of regexps. it doesn't add much, and (.*) is much more explicit. didn't realize that. not sure how many conversations i confused you with this.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

Awesome! Don't worry about it, at least we got to it eventually. I'll implement this tonight, add some more test cases and documentation and we should be ready to go. Then, I'll look at adding the feature the guy was after in path-match and the changes will cascade through.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

@jonathanong https://github.com/component/path-to-regexp/pull/28 - just need to update the keys array later with the syntax to denote these matches.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

Supported using + param suffix.

from path-to-regexp.

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.