isPrerelease
Returns true when the version string has a prerelease suffix
(i.e. contains a - after the core MAJOR.MINOR.PATCH).
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
version | string | A semantic version string (e.g. '2.0.0-alpha.1', '1.0.0'). |
Returns
Section titled “Returns”boolean — true if the version is a prerelease, false otherwise.
Examples
Section titled “Examples”Detect a prerelease version
Section titled “Detect a prerelease version”Returns true for any version string that contains a prerelease suffix.
Stable versions return false
Section titled “Stable versions return false”Returns false when the version has no prerelease suffix.
Accept a ParsedVersion object
Section titled “Accept a ParsedVersion object”Works with the result of parse() — checks the prerelease array instead of string matching.
