yarn path-to-regexp 6.0.0
Custom Prefix and Suffix Groups

latest releases: 6.2.0, 6.1.0
4 years ago

Note: The path syntax has been stabilized with this release, no breaking changes in paths is expected.

This release reverts the prefix behavior added in v3 back to the behavior seen in v2. For the most part, path matching is backward compatible with v2 with these enhancements:

  1. Support for nested non-capturing groups in regexp, e.g. /(abc(?=d))
  2. Support for custom prefix and suffix groups using /{abc(.*)def}
  3. Tokens in an unexpected position will throw an error
    • Things like /test(foo previously would worked, now it expects ( to be closed
    • You can escape the character for the previous behavior, e.g. /test\(foo

Changed

  • Revert using any character as prefix, support prefixes option to configure this (starts as /. which acts like every version since 0.x again)
  • Add support for {} to capture prefix/suffix explicitly, enables custom use-cases like /:attr1{-:attr2}?

Don't miss a new path-to-regexp release

NewReleases is sending notifications on new releases.