@bgord/tools 0.12.24 → 0.12.26

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.
@@ -14,6 +14,7 @@ export declare class PackageVersion {
14
14
  readonly patch: PatchType;
15
15
  constructor(major: MajorType, minor: MinorType, patch: PatchType);
16
16
  isGreaterThanOrEqual(another: PackageVersion): boolean;
17
+ toString(): string;
17
18
  static fromStringWithV(value: string): PackageVersion;
18
19
  static fromString(value: string): PackageVersion;
19
20
  }
@@ -62,6 +62,9 @@ export class PackageVersion {
62
62
  return false;
63
63
  return true;
64
64
  }
65
+ toString() {
66
+ return `${this.major}.${this.minor}.${this.patch}`;
67
+ }
65
68
  static fromStringWithV(value) {
66
69
  const version = PackageVersionValue.parse(value);
67
70
  return new PackageVersion(version.major, version.minor, version.patch);
@@ -15,9 +15,6 @@ export class RateLimiter {
15
15
  this.lastInvocationTimestampMs = currentTimestampMs;
16
16
  return { allowed: true };
17
17
  }
18
- return {
19
- allowed: false,
20
- remainingMs: Timestamp.parse(nextAllowedTimestampMs - currentTimestampMs),
21
- };
18
+ return { allowed: false, remainingMs: Timestamp.parse(nextAllowedTimestampMs - currentTimestampMs) };
22
19
  }
23
20
  }
@@ -9,9 +9,6 @@ export class RelativeDate {
9
9
  return RelativeDate._format(timestampMs);
10
10
  }
11
11
  static _format(timestampMs) {
12
- return {
13
- raw: timestampMs,
14
- relative: DateFormatters.relative(timestampMs),
15
- };
12
+ return { raw: timestampMs, relative: DateFormatters.relative(timestampMs) };
16
13
  }
17
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgord/tools",
3
- "version": "0.12.24",
3
+ "version": "0.12.26",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Bartosz Gordon",
@@ -21,25 +21,25 @@
21
21
  "preinstall": "bunx only-allow bun"
22
22
  },
23
23
  "devDependencies": {
24
- "@biomejs/biome": "2.2.3",
24
+ "@biomejs/biome": "2.2.4",
25
25
  "@commitlint/cli": "19.8.1",
26
26
  "@commitlint/config-conventional": "19.8.1",
27
- "@types/bun": "1.2.21",
27
+ "@types/bun": "1.2.22",
28
28
  "@types/mime-types": "3.0.1",
29
29
  "cspell": "9.2.1",
30
30
  "knip": "5.63.1",
31
- "lefthook": "1.12.4",
31
+ "lefthook": "1.13.0",
32
32
  "only-allow": "1.2.1",
33
33
  "shellcheck": "4.1.0",
34
34
  "typescript": "5.9.2",
35
- "zod": "4.1.5"
35
+ "zod": "4.1.8"
36
36
  },
37
37
  "dependencies": {
38
38
  "date-fns": "4.1.0",
39
39
  "mime-types": "3.0.1"
40
40
  },
41
41
  "peerDependencies": {
42
- "zod": "4.1.5"
42
+ "zod": "4.1.8"
43
43
  },
44
44
  "sideEffects": false
45
45
  }
@@ -81,6 +81,10 @@ export class PackageVersion {
81
81
  return true;
82
82
  }
83
83
 
84
+ toString() {
85
+ return `${this.major}.${this.minor}.${this.patch}`;
86
+ }
87
+
84
88
  static fromStringWithV(value: string) {
85
89
  const version = PackageVersionValue.parse(value);
86
90
 
@@ -6,10 +6,7 @@ type RateLimiterOptionsType = Pick<TimeResult, "ms">;
6
6
 
7
7
  type RateLimiterResultSuccessType = { allowed: true };
8
8
 
9
- type RateLimiterResultErrorType = {
10
- allowed: false;
11
- remainingMs: TimestampType;
12
- };
9
+ type RateLimiterResultErrorType = { allowed: false; remainingMs: TimestampType };
13
10
 
14
11
  type RateLimiterResultType = RateLimiterResultSuccessType | RateLimiterResultErrorType;
15
12
 
@@ -33,9 +30,6 @@ export class RateLimiter {
33
30
  return { allowed: true };
34
31
  }
35
32
 
36
- return {
37
- allowed: false,
38
- remainingMs: Timestamp.parse(nextAllowedTimestampMs - currentTimestampMs),
39
- };
33
+ return { allowed: false, remainingMs: Timestamp.parse(nextAllowedTimestampMs - currentTimestampMs) };
40
34
  }
41
35
  }
@@ -16,9 +16,6 @@ export class RelativeDate {
16
16
  }
17
17
 
18
18
  private static _format(timestampMs: TimestampType): RelativeDateType {
19
- return {
20
- raw: timestampMs,
21
- relative: DateFormatters.relative(timestampMs),
22
- };
19
+ return { raw: timestampMs, relative: DateFormatters.relative(timestampMs) };
23
20
  }
24
21
  }