Skip to content

Commit 1d1b8b4

Browse files
committed
Use tuple instead of object to reduce minified code size
1 parent 53cbbce commit 1d1b8b4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/datetime/fromRfc2822.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,16 @@ function parse(date: string) {
9898
) {
9999
throw new Error("something wrong");
100100
}
101-
return {
102-
year: fullYear(year),
103-
month: getMonthNumberFromAbbreviation(monthName),
104-
day: parseInt(day, 10),
105-
hour: parseInt(hour, 10),
106-
minute: parseInt(minute, 10),
107-
second: parseInt(second),
101+
return [
102+
fullYear(year),
103+
getMonthNumberFromAbbreviation(monthName),
104+
parseInt(day),
105+
parseInt(hour, 10),
106+
parseInt(minute, 10),
107+
parseInt(second),
108108
dayOfWeek,
109109
timeZone,
110-
};
110+
] as const;
111111
}
112112

113113
/**
@@ -128,7 +128,7 @@ export function fromRfc2822<
128128
): InstanceType<TemporalClassType> {
129129
const dateWithoutComment = date.includes("(") ? removeComment(date) : date;
130130

131-
const { year, month, day, hour, minute, second, dayOfWeek, timeZone } =
131+
const [year, month, day, hour, minute, second, dayOfWeek, timeZone] =
132132
parse(dateWithoutComment);
133133
if (
134134
dayOfWeek !== undefined &&

0 commit comments

Comments
 (0)