MCPcopy Create free account
hub / github.com/alignoth/alignoth / constructor

Method constructor

resources/vega-embed.min.js:905–948  ·  view source on GitHub ↗
(a, l)

Source from the content-addressed store, hash-verified

903 })();
904 class s {
905 constructor(a, l) {
906 if (((l = o(l)), a instanceof s)) {
907 if (
908 a.loose === !!l.loose &&
909 a.includePrerelease === !!l.includePrerelease
910 )
911 return a;
912 a = a.version;
913 } else if ("string" != typeof a)
914 throw new TypeError(
915 `Invalid version. Must be a string. Got type "${typeof a}".`,
916 );
917 if (a.length > t)
918 throw new TypeError(`version is longer than ${t} characters`);
919 (e("SemVer", a, l),
920 (this.options = l),
921 (this.loose = !!l.loose),
922 (this.includePrerelease = !!l.includePrerelease));
923 const c = a.trim().match(l.loose ? r[i.LOOSE] : r[i.FULL]);
924 if (!c) throw new TypeError(`Invalid Version: ${a}`);
925 if (
926 ((this.raw = a),
927 (this.major = +c[1]),
928 (this.minor = +c[2]),
929 (this.patch = +c[3]),
930 this.major > n || this.major < 0)
931 )
932 throw new TypeError("Invalid major version");
933 if (this.minor > n || this.minor < 0)
934 throw new TypeError("Invalid minor version");
935 if (this.patch > n || this.patch < 0)
936 throw new TypeError("Invalid patch version");
937 (c[4]
938 ? (this.prerelease = c[4].split(".").map((e) => {
939 if (/^[0-9]+$/.test(e)) {
940 const t = +e;
941 if (t >= 0 && t < n) return t;
942 }
943 return e;
944 }))
945 : (this.prerelease = []),
946 (this.build = c[5] ? c[5].split(".") : []),
947 this.format());
948 }
949 format() {
950 return (
951 (this.version = `${this.major}.${this.minor}.${this.patch}`),

Callers

nothing calls this directly

Calls 5

formatMethod · 0.95
eFunction · 0.85
testMethod · 0.80
oFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected