MCPcopy Create free account
hub / github.com/material-shell/material-shell / compareVersions

Function compareVersions

src/utils/shellVersionMatch.ts:112–121  ·  view source on GitHub ↗
(lhs: number[], rhs: number[])

Source from the content-addressed store, hash-verified

110/// Compares to versions, returns -1 if lhs < rhs, 1 if lhs > rhs and 0 if lhs == rhs
111/// Lhs and rhs may be of different lengths, missing components will be assumed to be zero.
112export function compareVersions(lhs: number[], rhs: number[]) {
113 for (let i = 0; i < Math.max(lhs.length, rhs.length); i++) {
114 const a = i < lhs.length ? lhs[i] : 0;
115 const b = i < rhs.length ? rhs[i] : 0;
116 if (a != b) {
117 return a < b ? -1 : 1;
118 }
119 }
120 return 0;
121}
122
123export const gnomeVersionNumber = parseVersion(PACKAGE_VERSION);
124

Callers 9

statusArea.tsFile · 0.90
disableMethod · 0.90
button.tsFile · 0.90
gnomeVersionEqualToFunction · 0.85

Calls 1

maxMethod · 0.65

Tested by

no test coverage detected