The documentation does not imply that invalid Semver tags should result
in a crash when using the semver strategy, but merely that these tags
should be ignored:
Find the latest tag that is SemVer compliant and increment its PATCH
version
This fix simply ensures that only valid semver tags are considered. This
was not the case because there are 3 parameters provided to the
Array.filter callback, the second being an int representing the index
of the element being filtered. The problem is that the semver.valid
function accepts two parameters and if the second is truthy, it will use
the LOOSE regex to validate the version, which may yield unwanted
results.
The documentation does not imply that invalid Semver tags should result in a crash when using the
semver
strategy, but merely that these tags should be ignored:This fix simply ensures that only valid semver tags are considered. This was not the case because there are 3 parameters provided to the
Array.filter
callback, the second being an int representing the index of the element being filtered. The problem is that thesemver.valid
function accepts two parameters and if the second is truthy, it will use theLOOSE
regex to validate the version, which may yield unwanted results.