Skip to content

Commit 047d413

Browse files
committed
Remove unused exports
This commit stops exporting functions that are not used outisde of the file where they are declared.
1 parent 6c6ef90 commit 047d413

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

lib/ecmascript.ts

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const YEAR_MIN = -271821;
6262
const YEAR_MAX = 275760;
6363
const BEFORE_FIRST_DST = bigInt(-388152).multiply(1e13); // 1847-01-01T00:00:00Z
6464

65-
export function IsInteger(value: unknown): value is number {
65+
function IsInteger(value: unknown): value is number {
6666
if (typeof value !== 'number' || !NumberIsFinite(value)) return false;
6767
const abs = MathAbs(value);
6868
return MathFloor(abs) === abs;
@@ -94,7 +94,7 @@ export function ToNumber(value: unknown): number {
9494
return NumberCtor(value);
9595
}
9696

97-
export function ToInteger(value: unknown): number {
97+
function ToInteger(value: unknown): number {
9898
const num = ToNumber(value);
9999
if (NumberIsNaN(num)) return 0;
100100
const integer = MathTrunc(num);
@@ -131,7 +131,7 @@ export function ToPositiveInteger(value, property?: string) {
131131
return value;
132132
}
133133

134-
export function ToIntegerNoFraction(value) {
134+
function ToIntegerNoFraction(value) {
135135
value = ToNumber(value);
136136
if (!IsInteger(value)) {
137137
throw new RangeError(`unsupported fractional value ${value}`);
@@ -258,7 +258,7 @@ export function IsTemporalMonthDay(item) {
258258
export function IsTemporalZonedDateTime(item) {
259259
return HasSlot(item, EPOCHNANOSECONDS, TIME_ZONE, CALENDAR);
260260
}
261-
export function TemporalTimeZoneFromString(stringIdent) {
261+
function TemporalTimeZoneFromString(stringIdent) {
262262
let { ianaName, offset, z } = ParseTemporalTimeZoneString(stringIdent);
263263
let identifier = ianaName;
264264
if (!identifier && z) identifier = 'UTC';
@@ -274,13 +274,13 @@ export function TemporalTimeZoneFromString(stringIdent) {
274274
return result;
275275
}
276276

277-
export function FormatCalendarAnnotation(id, showCalendar) {
277+
function FormatCalendarAnnotation(id, showCalendar) {
278278
if (showCalendar === 'never') return '';
279279
if (showCalendar === 'auto' && id === 'iso8601') return '';
280280
return `[u-ca=${id}]`;
281281
}
282282

283-
export function ParseISODateTime(isoString, { zoneRequired }) {
283+
function ParseISODateTime(isoString, { zoneRequired }) {
284284
const regex = zoneRequired ? PARSE.instant : PARSE.datetime;
285285
const match = regex.exec(isoString);
286286
if (!match) throw new RangeError(`invalid ISO 8601 string: ${isoString}`);
@@ -344,23 +344,23 @@ export function ParseISODateTime(isoString, { zoneRequired }) {
344344
};
345345
}
346346

347-
export function ParseTemporalInstantString(isoString) {
347+
function ParseTemporalInstantString(isoString) {
348348
return ParseISODateTime(isoString, { zoneRequired: true });
349349
}
350350

351-
export function ParseTemporalZonedDateTimeString(isoString) {
351+
function ParseTemporalZonedDateTimeString(isoString) {
352352
return ParseISODateTime(isoString, { zoneRequired: true });
353353
}
354354

355-
export function ParseTemporalDateTimeString(isoString) {
355+
function ParseTemporalDateTimeString(isoString) {
356356
return ParseISODateTime(isoString, { zoneRequired: false });
357357
}
358358

359-
export function ParseTemporalDateString(isoString) {
359+
function ParseTemporalDateString(isoString) {
360360
return ParseISODateTime(isoString, { zoneRequired: false });
361361
}
362362

363-
export function ParseTemporalTimeString(isoString) {
363+
function ParseTemporalTimeString(isoString) {
364364
const match = PARSE.time.exec(isoString);
365365
let hour, minute, second, millisecond, microsecond, nanosecond, calendar;
366366
if (match) {
@@ -381,7 +381,7 @@ export function ParseTemporalTimeString(isoString) {
381381
return { hour, minute, second, millisecond, microsecond, nanosecond, calendar };
382382
}
383383

384-
export function ParseTemporalYearMonthString(isoString) {
384+
function ParseTemporalYearMonthString(isoString) {
385385
const match = PARSE.yearmonth.exec(isoString);
386386
let year, month, calendar, referenceISODay;
387387
if (match) {
@@ -396,7 +396,7 @@ export function ParseTemporalYearMonthString(isoString) {
396396
return { year, month, calendar, referenceISODay };
397397
}
398398

399-
export function ParseTemporalMonthDayString(isoString) {
399+
function ParseTemporalMonthDayString(isoString) {
400400
const match = PARSE.monthday.exec(isoString);
401401
let month, day, calendar, referenceISOYear;
402402
if (match) {
@@ -408,7 +408,7 @@ export function ParseTemporalMonthDayString(isoString) {
408408
return { month, day, calendar, referenceISOYear };
409409
}
410410

411-
export function ParseTemporalTimeZoneString(stringIdent): {
411+
function ParseTemporalTimeZoneString(stringIdent): {
412412
ianaName?: string | undefined;
413413
offset?: string | undefined;
414414
z?: boolean | undefined;
@@ -431,7 +431,7 @@ export function ParseTemporalTimeZoneString(stringIdent): {
431431
}
432432
}
433433

434-
export function ParseTemporalDurationString(isoString) {
434+
function ParseTemporalDurationString(isoString) {
435435
const match = PARSE.duration.exec(isoString);
436436
if (!match) throw new RangeError(`invalid duration: ${isoString}`);
437437
if (match.slice(2).every((element) => element === undefined)) {
@@ -467,7 +467,7 @@ export function ParseTemporalDurationString(isoString) {
467467
return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };
468468
}
469469

470-
export function ParseTemporalInstant(isoString) {
470+
function ParseTemporalInstant(isoString) {
471471
const { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, offset, z } =
472472
ParseTemporalInstantString(isoString);
473473

@@ -522,7 +522,7 @@ export function RegulateISOYearMonth(year, month, overflow) {
522522
return { year, month };
523523
}
524524

525-
export function DurationHandleFractions(fHours, minutes, fMinutes, seconds, milliseconds, microseconds, nanoseconds) {
525+
function DurationHandleFractions(fHours, minutes, fMinutes, seconds, milliseconds, microseconds, nanoseconds) {
526526
if (fHours !== 0) {
527527
[minutes, fMinutes, seconds, milliseconds, microseconds, nanoseconds].forEach((val) => {
528528
if (val !== 0) throw new RangeError('only the smallest unit can be fractional');
@@ -561,7 +561,7 @@ export function DurationHandleFractions(fHours, minutes, fMinutes, seconds, mill
561561
return { minutes, seconds, milliseconds, microseconds, nanoseconds };
562562
}
563563

564-
export function ToTemporalDurationRecord(item) {
564+
function ToTemporalDurationRecord(item) {
565565
if (IsTemporalDuration(item)) {
566566
return {
567567
years: GetSlot(item, YEARS),
@@ -1722,7 +1722,7 @@ export function ToTemporalCalendar(calendarLike) {
17221722
return new TemporalCalendar(calendar);
17231723
}
17241724

1725-
export function GetTemporalCalendarWithISODefault(item) {
1725+
function GetTemporalCalendarWithISODefault(item) {
17261726
if (HasSlot(item, CALENDAR)) return GetSlot(item, CALENDAR);
17271727
const { calendar } = item;
17281728
if (calendar === undefined) return GetISO8601Calendar();
@@ -1853,7 +1853,7 @@ export function BuiltinTimeZoneGetInstantFor(timeZone, dateTime, disambiguation)
18531853
return DisambiguatePossibleInstants(possibleInstants, timeZone, dateTime, disambiguation);
18541854
}
18551855

1856-
export function DisambiguatePossibleInstants(possibleInstants, timeZone, dateTime, disambiguation) {
1856+
function DisambiguatePossibleInstants(possibleInstants, timeZone, dateTime, disambiguation) {
18571857
const Instant = GetIntrinsic('%Temporal.Instant%');
18581858
const numInstants = possibleInstants.length;
18591859

@@ -1978,7 +1978,7 @@ export function DisambiguatePossibleInstants(possibleInstants, timeZone, dateTim
19781978
}
19791979
}
19801980

1981-
export function GetPossibleInstantsFor(timeZone, dateTime) {
1981+
function GetPossibleInstantsFor(timeZone, dateTime) {
19821982
const possibleInstants = timeZone.getPossibleInstantsFor(dateTime);
19831983
const result = [];
19841984
for (const instant of possibleInstants) {
@@ -2262,7 +2262,7 @@ export function GetIANATimeZoneOffsetNanoseconds(epochNanoseconds, id) {
22622262
return +utc.minus(epochNanoseconds);
22632263
}
22642264

2265-
export function FormatTimeZoneOffsetString(offsetNanoseconds) {
2265+
function FormatTimeZoneOffsetString(offsetNanoseconds) {
22662266
const sign = offsetNanoseconds < 0 ? '-' : '+';
22672267
offsetNanoseconds = MathAbs(offsetNanoseconds);
22682268
const nanoseconds = offsetNanoseconds % 1e9;
@@ -2299,7 +2299,7 @@ export function GetEpochFromISOParts(year, month, day, hour, minute, second, mil
22992299
return ns;
23002300
}
23012301

2302-
export function GetISOPartsFromEpoch(epochNanoseconds) {
2302+
function GetISOPartsFromEpoch(epochNanoseconds) {
23032303
const { quotient, remainder } = bigInt(epochNanoseconds).divmod(1e6);
23042304
let epochMilliseconds = +quotient;
23052305
let nanos = +remainder;
@@ -2509,7 +2509,7 @@ export function DurationSign(y, mon, w, d, h, min, s, ms, µs, ns) {
25092509
return 0;
25102510
}
25112511

2512-
export function BalanceISOYearMonth(year, month) {
2512+
function BalanceISOYearMonth(year, month) {
25132513
if (!NumberIsFinite(year) || !NumberIsFinite(month)) throw new RangeError('infinity is out of range');
25142514
month -= 1;
25152515
year += MathFloor(month / 12);
@@ -2519,7 +2519,7 @@ export function BalanceISOYearMonth(year, month) {
25192519
return { year, month };
25202520
}
25212521

2522-
export function BalanceISODate(year, month, day) {
2522+
function BalanceISODate(year, month, day) {
25232523
if (!NumberIsFinite(day)) throw new RangeError('infinity is out of range');
25242524
({ year, month } = BalanceISOYearMonth(year, month));
25252525
let daysInYear = 0;
@@ -2548,7 +2548,7 @@ export function BalanceISODate(year, month, day) {
25482548
return { year, month, day };
25492549
}
25502550

2551-
export function BalanceISODateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond) {
2551+
function BalanceISODateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond) {
25522552
let deltaDays;
25532553
({ deltaDays, hour, minute, second, millisecond, microsecond, nanosecond } = BalanceTime(
25542554
hour,
@@ -2562,7 +2562,7 @@ export function BalanceISODateTime(year, month, day, hour, minute, second, milli
25622562
return { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond };
25632563
}
25642564

2565-
export function BalanceTime(hour, minute, second, millisecond, microsecond, nanosecond) {
2565+
function BalanceTime(hour, minute, second, millisecond, microsecond, nanosecond) {
25662566
if (
25672567
!NumberIsFinite(hour) ||
25682568
!NumberIsFinite(minute) ||
@@ -2614,7 +2614,7 @@ export function TotalDurationNanoseconds(
26142614
return bigInt(nanoseconds).add(microseconds.multiply(1000));
26152615
}
26162616

2617-
export function NanosecondsToDays(nanoseconds, relativeTo) {
2617+
function NanosecondsToDays(nanoseconds, relativeTo) {
26182618
const TemporalInstant = GetIntrinsic('%Temporal.Instant%');
26192619
const sign = MathSign(nanoseconds);
26202620
nanoseconds = bigInt(nanoseconds);
@@ -3000,13 +3000,13 @@ export function CreateNegatedTemporalDuration(duration) {
30003000
export function ConstrainToRange(value, min, max) {
30013001
return MathMin(max, MathMax(min, value));
30023002
}
3003-
export function ConstrainISODate(year, month, day?: any) {
3003+
function ConstrainISODate(year, month, day?: any) {
30043004
month = ConstrainToRange(month, 1, 12);
30053005
day = ConstrainToRange(day, 1, ISODaysInMonth(year, month));
30063006
return { year, month, day };
30073007
}
30083008

3009-
export function ConstrainTime(hour, minute, second, millisecond, microsecond, nanosecond) {
3009+
function ConstrainTime(hour, minute, second, millisecond, microsecond, nanosecond) {
30103010
hour = ConstrainToRange(hour, 0, 23);
30113011
minute = ConstrainToRange(minute, 0, 59);
30123012
second = ConstrainToRange(second, 0, 59);
@@ -3020,12 +3020,12 @@ export function RejectToRange(value, min, max) {
30203020
if (value < min || value > max) throw new RangeError(`value out of range: ${min} <= ${value} <= ${max}`);
30213021
}
30223022

3023-
export function RejectISODate(year, month, day) {
3023+
function RejectISODate(year, month, day) {
30243024
RejectToRange(month, 1, 12);
30253025
RejectToRange(day, 1, ISODaysInMonth(year, month));
30263026
}
30273027

3028-
export function RejectDateRange(year, month, day) {
3028+
function RejectDateRange(year, month, day) {
30293029
// Noon avoids trouble at edges of DateTime range (excludes midnight)
30303030
RejectDateTimeRange(year, month, day, 12, 0, 0, 0, 0, 0);
30313031
}
@@ -3039,12 +3039,12 @@ export function RejectTime(hour, minute, second, millisecond, microsecond, nanos
30393039
RejectToRange(nanosecond, 0, 999);
30403040
}
30413041

3042-
export function RejectDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond) {
3042+
function RejectDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond) {
30433043
RejectISODate(year, month, day);
30443044
RejectTime(hour, minute, second, millisecond, microsecond, nanosecond);
30453045
}
30463046

3047-
export function RejectDateTimeRange(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond) {
3047+
function RejectDateTimeRange(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond) {
30483048
RejectToRange(year, YEAR_MIN, YEAR_MAX);
30493049
// Reject any DateTime 24 hours or more outside the Instant range
30503050
if (
@@ -3065,7 +3065,7 @@ export function ValidateEpochNanoseconds(epochNanoseconds) {
30653065
}
30663066
}
30673067

3068-
export function RejectYearMonthRange(year, month) {
3068+
function RejectYearMonthRange(year, month) {
30693069
RejectToRange(year, YEAR_MIN, YEAR_MAX);
30703070
if (year === YEAR_MIN) {
30713071
RejectToRange(month, 4, 12);
@@ -3074,7 +3074,7 @@ export function RejectYearMonthRange(year, month) {
30743074
}
30753075
}
30763076

3077-
export function RejectDuration(y, mon, w, d, h, min, s, ms, µs, ns) {
3077+
function RejectDuration(y, mon, w, d, h, min, s, ms, µs, ns) {
30783078
const sign = DurationSign(y, mon, w, d, h, min, s, ms, µs, ns);
30793079
for (const prop of [y, mon, w, d, h, min, s, ms, µs, ns]) {
30803080
if (!NumberIsFinite(prop)) throw new RangeError('infinite values not allowed as duration fields');
@@ -3689,7 +3689,7 @@ export function AddZonedDateTime(
36893689
return AddInstant(GetSlot(instantIntermediate, EPOCHNANOSECONDS), h, min, s, ms, µs, ns);
36903690
}
36913691

3692-
export function RoundNumberToIncrement(quantity, increment, mode) {
3692+
function RoundNumberToIncrement(quantity, increment, mode) {
36933693
if (increment === 1) return quantity;
36943694
let { quotient, remainder } = quantity.divmod(increment);
36953695
if (remainder.equals(bigInt.zero)) return quantity;
@@ -3809,7 +3809,7 @@ export function RoundTime(
38093809
}
38103810
}
38113811

3812-
export function DaysUntil(earlier, later) {
3812+
function DaysUntil(earlier, later) {
38133813
return DifferenceISODate(
38143814
GetSlot(earlier, ISO_YEAR),
38153815
GetSlot(earlier, ISO_MONTH),
@@ -3821,7 +3821,7 @@ export function DaysUntil(earlier, later) {
38213821
).days;
38223822
}
38233823

3824-
export function MoveRelativeDate(calendar, relativeTo, duration) {
3824+
function MoveRelativeDate(calendar, relativeTo, duration) {
38253825
const options = ObjectCreate(null);
38263826
const later = CalendarDateAdd(calendar, relativeTo, duration, options);
38273827
const days = DaysUntil(relativeTo, later);
@@ -4223,7 +4223,7 @@ export function CompareISODate(y1, m1, d1, y2, m2, d2) {
42234223
return 0;
42244224
}
42254225

4226-
export function NonNegativeModulo(x, y) {
4226+
function NonNegativeModulo(x, y) {
42274227
let result = x % y;
42284228
if (ObjectIs(result, -0)) return 0;
42294229
if (result < 0) result += y;
@@ -4298,7 +4298,7 @@ export function GetOptionsObject(options) {
42984298
throw new TypeError(`Options parameter must be an object, not ${options === null ? 'null' : `a ${typeof options}`}`);
42994299
}
43004300

4301-
export function GetOption(options, property, allowedValues, fallback) {
4301+
function GetOption(options, property, allowedValues, fallback) {
43024302
let value = options[property];
43034303
if (value !== undefined) {
43044304
value = ToString(value);
@@ -4310,7 +4310,7 @@ export function GetOption(options, property, allowedValues, fallback) {
43104310
return fallback;
43114311
}
43124312

4313-
export function GetNumberOption(options, property, minimum, maximum, fallback) {
4313+
function GetNumberOption(options, property, minimum, maximum, fallback) {
43144314
let value = options[property];
43154315
if (value === undefined) return fallback;
43164316
value = ToNumber(value);

lib/regex.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
const tzComponent = /\.[-A-Za-z_]|\.\.[-A-Za-z._]{1,12}|\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}/;
22
const offsetNoCapture = /(?:[+\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\d{1,9})?)?)?)/;
3-
export const timeZoneID = new RegExp(
3+
const timeZoneID = new RegExp(
44
`(?:(?:${tzComponent.source})(?:\\/(?:${tzComponent.source}))*|Etc/GMT[-+]\\d{1,2}|${offsetNoCapture.source})`
55
);
66

77
const calComponent = /[A-Za-z0-9]{3,8}/;
8-
export const calendarID = new RegExp(`(?:${calComponent.source}(?:-${calComponent.source})*)`);
8+
const calendarID = new RegExp(`(?:${calComponent.source}(?:-${calComponent.source})*)`);
99

1010
const yearpart = /(?:[+\u2212-]\d{6}|\d{4})/;
1111
const monthpart = /(?:0[1-9]|1[0-2])/;
1212
const daypart = /(?:0[1-9]|[12]\d|3[01])/;
13-
export const datesplit = new RegExp(
13+
const datesplit = new RegExp(
1414
`(${yearpart.source})(?:-(${monthpart.source})-(${daypart.source})|(${monthpart.source})(${daypart.source}))`
1515
);
1616
const timesplit = /(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/;

0 commit comments

Comments
 (0)