MCPcopy Create free account
hub / github.com/GnomeSnapExtensions/gSnap / constructor

Method constructor

src/extension/shellversion.ts:31–46  ·  view source on GitHub ↗
(version: string)

Source from the content-addressed store, hash-verified

29 private readonly rawVersion: string;
30
31 private constructor(version: string) {
32 const parts = version.split('.').map((part) => Number(part));
33 if (parts.length < 2) {
34 throw new Error(`invalid version supplied: ${version}`);
35 }
36 this.major = parts[0];
37 this.minor = parts[1];
38 // Tolerate "40.alpha.1" for example. See https://github.com/gSnap/gSnap/issues/187.
39 if (isNaN(this.minor)) {
40 this.minor = 0;
41 }
42 if (isNaN(this.major)) {
43 throw new Error(`invalid version supplied: ${JSON.stringify(version)}; got major = ${this.major}, minor = ${this.minor}`);
44 }
45 this.rawVersion = version;
46 }
47
48 public static defaultVersion(): ShellVersion {
49 return ShellVersion.parse(Config.PACKAGE_VERSION);

Callers

nothing calls this directly

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected