parse
Parses a semantic version string into its components according to SemVer 2.0.0 specification
Supports:
- Core version: MAJOR.MINOR.PATCH
- Pre-release: -alpha, -beta.1, -rc.1, -0.3.7, -x.7.z.92
- Build metadata: +build, +sha.abc123, +20130313144700
- Optional ‘v’ prefix (commonly used in git tags)
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
version | string | Version string to parse |
Returns
Section titled “Returns”ParsedVersion — Parsed version object with major, minor, patch, prerelease, and build
Examples
Section titled “Examples”Parse a semver string
Section titled “Parse a semver string”Breaks a semantic version string into its components.
Parse a prerelease version
Section titled “Parse a prerelease version”Handles prerelease identifiers and optional v prefix.
Related Types
Section titled “Related Types”ParsedVersion
Section titled “ParsedVersion”Represents a parsed semantic version according to SemVer 2.0.0 specification
