Skip to content

Commit 9934a0f

Browse files
committed
Remove usage of private fields
Downleveling this with the TypeScript compiler would add a runtime dependency on tslib. The TimeDuration object is private anyway and not exported to client code, so we don't strictly need this method to be private.
1 parent 810fc7d commit 9934a0f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/timeduration.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class TimeDuration {
5757
assert(MathAbs(this.subsec) <= 999_999_999, 'subseconds too big');
5858
}
5959

60-
static #validateNew(totalNs: JSBI, operation: string) {
60+
static validateNew(totalNs: JSBI, operation: string) {
6161
if (JSBI.greaterThan(abs(totalNs), TimeDuration.MAX)) {
6262
throw new RangeErrorCtor(`${operation} of duration time units cannot exceed ${TimeDuration.MAX} s`);
6363
}
@@ -84,20 +84,20 @@ export class TimeDuration {
8484
),
8585
JSBI.multiply(JSBI.BigInt(h), HOUR_NANOS)
8686
);
87-
return TimeDuration.#validateNew(totalNs, 'total');
87+
return TimeDuration.validateNew(totalNs, 'total');
8888
}
8989

9090
abs() {
9191
return new TimeDuration(abs(this.totalNs));
9292
}
9393

9494
add(other: TimeDuration) {
95-
return TimeDuration.#validateNew(JSBI.add(this.totalNs, other.totalNs), 'sum');
95+
return TimeDuration.validateNew(JSBI.add(this.totalNs, other.totalNs), 'sum');
9696
}
9797

9898
add24HourDays(days: number) {
9999
assert(NumberIsInteger(days), 'days must be an integer');
100-
return TimeDuration.#validateNew(JSBI.add(this.totalNs, JSBI.multiply(JSBI.BigInt(days), DAY_NANOS_JSBI)), 'sum');
100+
return TimeDuration.validateNew(JSBI.add(this.totalNs, JSBI.multiply(JSBI.BigInt(days), DAY_NANOS_JSBI)), 'sum');
101101
}
102102

103103
addToEpochNs(epochNs: JSBI | bigint) {
@@ -153,14 +153,14 @@ export class TimeDuration {
153153
? r1
154154
: ApplyUnsignedRoundingMode(r1, r2, cmp, isEven(quotient), unsignedRoundingMode);
155155
const result = sign === 'positive' ? rounded : JSBI.unaryMinus(rounded);
156-
return TimeDuration.#validateNew(result, 'rounding');
156+
return TimeDuration.validateNew(result, 'rounding');
157157
}
158158

159159
sign() {
160160
return this.cmp(new TimeDuration(ZERO));
161161
}
162162

163163
subtract(other: TimeDuration) {
164-
return TimeDuration.#validateNew(JSBI.subtract(this.totalNs, other.totalNs), 'difference');
164+
return TimeDuration.validateNew(JSBI.subtract(this.totalNs, other.totalNs), 'difference');
165165
}
166166
}

0 commit comments

Comments
 (0)