Semver
Semantic Versioning
A versioning scheme using MAJOR.MINOR.PATCH format to communicate the nature of changes in software.
तकनीकी विवरण
Semver encodes backward-compatibility promises in the version number. MAJOR changes indicate breaking API changes, MINOR adds backward-compatible features, and PATCH fixes bugs without API changes. Pre-release versions use hyphens (1.0.0-alpha.1) and build metadata uses plus signs (1.0.0+20260308). The caret (^1.2.3) and tilde (~1.2.3) range operators in package managers interpret version constraints differently: caret allows minor updates, tilde allows only patch updates.
उदाहरण
```javascript
// Parse semantic version
const [major, minor, patch] = '2.4.1'.split('.').map(Number);
// Version comparison
function semverCompare(a, b) {
const pa = a.split('.').map(Number);
const pb = b.split('.').map(Number);
for (let i = 0; i < 3; i++) {
if (pa[i] !== pb[i]) return pa[i] - pb[i];
}
return 0;
}
```