Skip to content

regexp should not end with both explicit end-slash and optional end-slash #441

Description

@iambumblehead

Hello and thanks for this package. When the original path ends with an end-slash (ex '/about/') the returned regexp ends with both a required and an optional end-slash; I believe, instead, it should end with only one end-slash; optional or required.

Instead of this,

pathToRegexp('/about/').regexp // /^(?:\/about\/)(?:\/$)?$/i

One of these would be better,

pathToRegexp('/about/').regexp // /^(?:\/about)(?:\/$)?$/i
pathToRegexp('/about/').regexp // /^(?:\/about\/)$/i

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions