@fi4f/v 1.1.1 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/index.d.ts CHANGED
@@ -1,17 +1,22 @@
1
- export declare function Version(o?: {
2
- moniker?: string;
3
- major?: number;
4
- minor?: number;
5
- patch?: number;
6
- }): Version;
7
1
  export interface Version {
8
2
  readonly moniker: string;
9
3
  readonly major: number;
10
4
  readonly minor: number;
11
5
  readonly patch: number;
12
6
  }
13
- export declare namespace Version {
14
- function toString(a: Version): string;
15
- function compare(a: Version, b: Version): number;
16
- }
7
+ export declare const Version: {
8
+ "new"(o?: {
9
+ moniker?: string;
10
+ major?: number;
11
+ minor?: number;
12
+ patch?: number;
13
+ }): {
14
+ moniker: string;
15
+ major: number;
16
+ minor: number;
17
+ patch: number;
18
+ };
19
+ toString(a: Version): string;
20
+ compare(a: Version, b: Version): number;
21
+ };
17
22
  export default Version;
package/out/index.js CHANGED
@@ -1,30 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Version = Version;
4
- function Version(o) {
5
- var _a, _b, _c, _d;
6
- return {
7
- moniker: (_a = o === null || o === void 0 ? void 0 : o.moniker) !== null && _a !== void 0 ? _a : "v",
8
- major: (_b = o === null || o === void 0 ? void 0 : o.major) !== null && _b !== void 0 ? _b : 0,
9
- minor: (_c = o === null || o === void 0 ? void 0 : o.minor) !== null && _c !== void 0 ? _c : 0,
10
- patch: (_d = o === null || o === void 0 ? void 0 : o.patch) !== null && _d !== void 0 ? _d : 0,
11
- };
12
- }
13
- (function (Version) {
14
- function toString(a) {
3
+ exports.Version = void 0;
4
+ exports.Version = {
5
+ new(o) {
6
+ var _a, _b, _c, _d;
7
+ return {
8
+ moniker: (_a = o === null || o === void 0 ? void 0 : o.moniker) !== null && _a !== void 0 ? _a : "v",
9
+ major: (_b = o === null || o === void 0 ? void 0 : o.major) !== null && _b !== void 0 ? _b : 0,
10
+ minor: (_c = o === null || o === void 0 ? void 0 : o.minor) !== null && _c !== void 0 ? _c : 0,
11
+ patch: (_d = o === null || o === void 0 ? void 0 : o.patch) !== null && _d !== void 0 ? _d : 0,
12
+ };
13
+ },
14
+ toString(a) {
15
15
  return `${a.moniker} ${a.major}.${a.minor}.${a.patch}`;
16
- }
17
- Version.toString = toString;
18
- function compare(a, b) {
16
+ },
17
+ compare(a, b) {
19
18
  let k;
20
- if ((k = a.major - b.major) != 0)
19
+ if ((k = a.major - b.major) !== 0)
21
20
  return k;
22
- if ((k = a.minor - b.minor) != 0)
21
+ if ((k = a.minor - b.minor) !== 0)
23
22
  return k;
24
- if ((k = a.patch - b.patch) != 0)
23
+ if ((k = a.patch - b.patch) !== 0)
25
24
  return k;
26
25
  return 0;
27
26
  }
28
- Version.compare = compare;
29
- })(Version || (exports.Version = Version = {}));
30
- exports.default = Version;
27
+ };
28
+ exports.default = exports.Version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fi4f/v",
3
- "version": "1.1.1",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/fi4f/v.git"
package/src/index.ts CHANGED
@@ -1,17 +1,3 @@
1
- export function Version(o ?: {
2
- moniker ?: string;
3
- major ?: number;
4
- minor ?: number;
5
- patch ?: number;
6
- }): Version {
7
- return {
8
- moniker : o?.moniker ?? "v",
9
- major : o?.major ?? 0,
10
- minor : o?.minor ?? 0,
11
- patch : o?.patch ?? 0,
12
- }
13
- }
14
-
15
1
  export interface Version {
16
2
  readonly moniker: string;
17
3
  readonly major : number;
@@ -19,16 +5,30 @@ export interface Version {
19
5
  readonly patch : number;
20
6
  }
21
7
 
22
- export namespace Version {
23
- export function toString(a: Version) {
8
+ export const Version = {
9
+ new(o ?: {
10
+ moniker ?: string;
11
+ major ?: number;
12
+ minor ?: number;
13
+ patch ?: number;
14
+ }) {
15
+ return {
16
+ moniker : o?.moniker ?? "v",
17
+ major : o?.major ?? 0,
18
+ minor : o?.minor ?? 0,
19
+ patch : o?.patch ?? 0,
20
+ } satisfies Version;
21
+ },
22
+
23
+ toString(a: Version) {
24
24
  return `${a.moniker} ${a.major}.${a.minor}.${a.patch}`;
25
- }
25
+ },
26
26
 
27
- export function compare(a: Version, b: Version) {
27
+ compare(a: Version, b: Version) {
28
28
  let k: number;
29
- if((k = a.major - b.major) != 0) return k;
30
- if((k = a.minor - b.minor) != 0) return k;
31
- if((k = a.patch - b.patch) != 0) return k;
29
+ if((k = a.major - b.major) !== 0) return k;
30
+ if((k = a.minor - b.minor) !== 0) return k;
31
+ if((k = a.patch - b.patch) !== 0) return k;
32
32
  return 0;
33
33
  }
34
34
  }