@bgord/tools 1.2.13 → 1.2.14
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/dist/age-years.vo.js +2 -0
- package/dist/api-key.vo.js +2 -0
- package/dist/basename.vo.js +2 -0
- package/dist/day-iso-id.vo.js +2 -0
- package/dist/directory-path-absolute.vo.js +2 -0
- package/dist/directory-path-relative.vo.js +3 -1
- package/dist/distance-value.vo.js +2 -0
- package/dist/division-factor.vo.js +2 -0
- package/dist/dll.service.js +2 -6
- package/dist/duration-ms.vo.js +1 -0
- package/dist/email.vo.js +1 -0
- package/dist/etags.vo.js +0 -2
- package/dist/extension.vo.js +2 -0
- package/dist/file-path-absolute-schema.vo.js +2 -0
- package/dist/file-path-relative-schema.vo.js +2 -0
- package/dist/filename-affix.vo.js +2 -0
- package/dist/height-milimiters.vo.js +2 -0
- package/dist/hour-schema.vo.js +3 -1
- package/dist/iban-schema.vo.js +2 -0
- package/dist/image.vo.js +4 -0
- package/dist/integer-non-negative.vo.js +2 -0
- package/dist/integer-positive.vo.js +2 -0
- package/dist/integer.vo.js +1 -0
- package/dist/linear-regression.service.js +2 -0
- package/dist/mime-value.vo.js +2 -0
- package/dist/min-max-scaler.service.js +1 -1
- package/dist/minute-schema.vo.js +2 -0
- package/dist/minute.vo.d.ts +1 -1
- package/dist/minute.vo.js +3 -3
- package/dist/money-amount.vo.js +2 -0
- package/dist/month-iso-id.vo.js +2 -0
- package/dist/multiplication-factor.vo.js +2 -0
- package/dist/object-key.vo.js +2 -0
- package/dist/package-version-schema.vo.js +2 -0
- package/dist/package-version.vo.js +1 -5
- package/dist/pagination-page.vo.js +1 -1
- package/dist/percentage.service.js +0 -2
- package/dist/quarter-iso-id.vo.js +2 -0
- package/dist/random.service.js +1 -3
- package/dist/reordering.service.js +2 -0
- package/dist/rounding-decimal.strategy.js +2 -0
- package/dist/size-bytes.vo.js +2 -0
- package/dist/time-zone-offset-value.vo.js +6 -4
- package/dist/timestamp-value.vo.js +2 -0
- package/dist/timezone.vo.js +2 -0
- package/dist/url-with-slash.vo.js +3 -1
- package/dist/url-without-slash.vo.js +3 -1
- package/dist/week-iso-id.vo.js +2 -0
- package/dist/weekday.vo.d.ts +3 -1
- package/dist/weekday.vo.js +4 -3
- package/dist/weight-grams.vo.js +2 -0
- package/dist/weight.vo.d.ts +0 -2
- package/dist/weight.vo.js +1 -7
- package/dist/year-iso-id.vo.js +2 -0
- package/dist/year.vo.js +5 -1
- package/package.json +2 -1
- package/src/age-years.vo.ts +2 -0
- package/src/api-key.vo.ts +2 -0
- package/src/basename.vo.ts +2 -0
- package/src/day-iso-id.vo.ts +2 -0
- package/src/directory-path-absolute.vo.ts +2 -0
- package/src/directory-path-relative.vo.ts +3 -1
- package/src/distance-value.vo.ts +2 -0
- package/src/division-factor.vo.ts +2 -0
- package/src/dll.service.ts +4 -8
- package/src/duration-ms.vo.ts +2 -0
- package/src/email.vo.ts +2 -0
- package/src/etags.vo.ts +0 -2
- package/src/extension.vo.ts +2 -0
- package/src/file-path-absolute-schema.vo.ts +2 -0
- package/src/file-path-relative-schema.vo.ts +2 -0
- package/src/filename-affix.vo.ts +2 -0
- package/src/height-milimiters.vo.ts +2 -0
- package/src/hour-schema.vo.ts +3 -1
- package/src/iban-schema.vo.ts +2 -0
- package/src/image.vo.ts +4 -0
- package/src/integer-non-negative.vo.ts +2 -0
- package/src/integer-positive.vo.ts +2 -0
- package/src/integer.vo.ts +2 -0
- package/src/linear-regression.service.ts +2 -0
- package/src/mime-value.vo.ts +2 -0
- package/src/min-max-scaler.service.ts +1 -1
- package/src/minute-schema.vo.ts +2 -0
- package/src/minute.vo.ts +4 -4
- package/src/money-amount.vo.ts +2 -0
- package/src/month-iso-id.vo.ts +2 -0
- package/src/multiplication-factor.vo.ts +2 -0
- package/src/object-key.vo.ts +2 -0
- package/src/package-version-schema.vo.ts +2 -0
- package/src/package-version.vo.ts +1 -4
- package/src/pagination-page.vo.ts +1 -1
- package/src/percentage.service.ts +0 -1
- package/src/quarter-iso-id.vo.ts +2 -0
- package/src/random.service.ts +1 -2
- package/src/reordering.service.ts +2 -0
- package/src/rounding-decimal.strategy.ts +2 -0
- package/src/size-bytes.vo.ts +2 -0
- package/src/time-zone-offset-value.vo.ts +6 -4
- package/src/timestamp-value.vo.ts +2 -0
- package/src/timezone.vo.ts +2 -0
- package/src/url-with-slash.vo.ts +3 -1
- package/src/url-without-slash.vo.ts +3 -1
- package/src/week-iso-id.vo.ts +2 -0
- package/src/weekday.vo.ts +4 -2
- package/src/weight-grams.vo.ts +2 -0
- package/src/weight.vo.ts +1 -9
- package/src/year-iso-id.vo.ts +2 -0
- package/src/year.vo.ts +3 -1
package/src/weight-grams.vo.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { z } from "zod/v4";
|
|
|
2
2
|
|
|
3
3
|
export const WeightGramsError = { Type: "weight.grams.type", Invalid: "weight.grams.invalid" };
|
|
4
4
|
|
|
5
|
+
// Stryker disable all
|
|
5
6
|
export const WeightGrams = z
|
|
7
|
+
// Stryker restore all
|
|
6
8
|
.number(WeightGramsError.Type)
|
|
7
9
|
.int(WeightGramsError.Type)
|
|
8
10
|
.gte(0, WeightGramsError.Invalid)
|
package/src/weight.vo.ts
CHANGED
|
@@ -50,7 +50,7 @@ export class Weight {
|
|
|
50
50
|
subtract(other: Weight): Weight {
|
|
51
51
|
const result = this.grams - other.grams;
|
|
52
52
|
|
|
53
|
-
return new Weight(WeightGrams.parse(
|
|
53
|
+
return new Weight(WeightGrams.parse(Math.max(0, result)), this.rounding);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
multiply(factor: MultiplicationFactorType): Weight {
|
|
@@ -73,18 +73,10 @@ export class Weight {
|
|
|
73
73
|
return this.grams > other.grams;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
greaterThanOrEqual(other: Weight): boolean {
|
|
77
|
-
return this.grams >= other.grams;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
76
|
lessThan(other: Weight): boolean {
|
|
81
77
|
return this.grams < other.grams;
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
lessThanOrEqual(other: Weight): boolean {
|
|
85
|
-
return this.grams <= other.grams;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
80
|
isZero(): boolean {
|
|
89
81
|
return this.grams === 0;
|
|
90
82
|
}
|
package/src/year-iso-id.vo.ts
CHANGED
|
@@ -5,7 +5,9 @@ export const YearIsoIdError = { Type: "year.iso.id.type", BadChars: "year.iso.id
|
|
|
5
5
|
// Four digits
|
|
6
6
|
const YEAR_ISO_ID_CHARS_WHITELIST = /^[0-9]{4}$/;
|
|
7
7
|
|
|
8
|
+
// Stryker disable all
|
|
8
9
|
export const YearIsoId = z
|
|
10
|
+
// Stryker restore all
|
|
9
11
|
.string(YearIsoIdError.Type)
|
|
10
12
|
.regex(YEAR_ISO_ID_CHARS_WHITELIST, YearIsoIdError.BadChars)
|
|
11
13
|
.brand("YearIsoId");
|
package/src/year.vo.ts
CHANGED
|
@@ -38,7 +38,9 @@ export class Year extends DateRange {
|
|
|
38
38
|
isLeapYear(): boolean {
|
|
39
39
|
const year = getYear(this.getStart().ms);
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
if (year % 400 === 0) return true;
|
|
42
|
+
if (year % 100 === 0) return false;
|
|
43
|
+
return year % 4 === 0;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
previous(): Year {
|