Giter VIP home page Giter VIP logo

Comments (12)

blakeembrey avatar blakeembrey commented on July 24, 2024

Haha, agreed. Let me tidy that up now

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

How does "When set to true the trailing slash will not optional" sound? It should probably be easier to phrase in reverse even.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

"Must match exactly" sounds closer, but is kind of confusing since it only affects the trailing slash (omitted or not)

from path-to-regexp.

Fishrock123 avatar Fishrock123 commented on July 24, 2024

/route/ would still work with it's trailing slash in strict mode, correct?

(Actually, is that one optional in non-strict?)

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

Correct, you couldn't omit the trailing slash. Just as if you omitted the trailing slash, you would have to use /route to match. By default (false), it's optional. With it enabled, the slashes must match.

from path-to-regexp.

Fishrock123 avatar Fishrock123 commented on July 24, 2024

How about: "When set to false trailing slashes are optional"?

Assuming:

(Actually, is that one optional in non-strict?)

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

That's the preferred sentence, but false is the default behaviour.

from path-to-regexp.

Fishrock123 avatar Fishrock123 commented on July 24, 2024

Even better: "Trailing slashes are optional when strict is set to false."

Edit: Hmm, might not be so good as an options list item, prefer the former.

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

The only problem there is it's false by default, so I'd have to add "When false (default) trailing slashes are optional". How does that read?

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

Or "When true paths must match exactly with trailing slashes"?

from path-to-regexp.

blakeembrey avatar blakeembrey commented on July 24, 2024

Maybe I even put it back to the original "When set to true a trailing slash will affect the url matching"? I think this change may have snuck in when I was playing around with phrasing in the refactor.

from path-to-regexp.

Fishrock123 avatar Fishrock123 commented on July 24, 2024

I'm writing docs for the Router the express.js project is extracting from express and I'll probably be using this for it's options on it:

Options

  • strict - While set to false trailing slashes are optional. (default: false)

Edited: /When/While/

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.