version string
Optional
optionsOrLoose: boolean | Optionsan options object { loose }
(where loose is the only available option) or a boolean indicating whether to enable loose mode. In loose mode, the parser is more forgiving with imperfectly formatted semver strings
Optional
throwErrors: Twhether to throw an error if the version string is invalid or if there are other errors. Defaults to false
parsed version object, or null
if the version string is invalid or if there are other errors (if throwErrors
is truthy, an error will be thrown instead of returning null
)
Return the parsed version of a semver string, if the semver string is not valid, it returns
null
or throws an error depending on the value ofthrowErrors
Throws
TypeError if the version string is invalid or if there are other errors (if
throwErrors
is falsy, it will returnnull
instead of throwing an error)Example
Remarks
build identifier (
[+BUILD]
) is taken into account