regexp should not end with both explicit end-slash and optional end-slash
Author: iambumbleheadCreated Apr 23, 2026Updated Jun 11, 2026
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\/)(?:\/$)?$/iOne of these would be better,
pathToRegexp('/about/').regexp // /^(?:\/about)(?:\/$)?$/i
pathToRegexp('/about/').regexp // /^(?:\/about\/)$/iSource: pillarjs/path-to-regexp