Closed
Description
According to SemVer 2.0.0, a version like v1.2.3
is not valid (https://semver.org/#is-v123-a-semantic-version).
The library incorrectly marks a version like this as valid:
const semverValid = require('semver/functions/valid')
semverValid('v1.2.3')
// true
semverValid('v1.2.3', {loose: false})
// true
I understand that the v-prefix is often used to indicate that some string represents a version. However, when I explicitly want to check if a string is valid according to the SemVer spec, I expect the method to return false in this case, especially when I set the loose
option to false
.
A fix (or an option to be extra strict for backwards compatibility) would be appreciated!