UNPKG

779 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.nodeJsVer = void 0;
4class VersionContainer {
5 constructor(version) {
6 const arr = version.split(/[v.]/g).filter((v) => v !== "");
7 this.major = Number.parseInt(arr[0], 10);
8 this.minor = Number.parseInt(arr[1], 10);
9 // eslint-disable-next-line prefer-destructuring
10 this.patch = arr[2] ? Number.parseInt(arr[2], 10) : 0;
11 this.patchSuffix = arr[2] ? arr[2].replace(this.patch.toString(), "") : "";
12 }
13 valueOf() {
14 return Number.parseInt(this.major.toString() + this.minor.toString() + this.patch.toString(), 10);
15 }
16}
17exports.default = VersionContainer;
18exports.nodeJsVer = new VersionContainer(process.version);