Skip to content

Commit b9f4457

Browse files
committed
Update compression to work with [email protected]
Thanks to @jscottiii for providing an example redirected feature to look for!
1 parent a6c70a0 commit b9f4457

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

scripts/compress-data.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,20 @@ const compressSupportObject = (
3636
};
3737
};
3838

39-
const featuresOutput = Object.entries(features)
40-
.filter(([, feature]) => feature.status?.baseline_low_date)
41-
.map(([, feature]) => [
42-
feature.status?.baseline_low_date ?? "",
43-
feature.status.support ? compressSupportObject(feature.status.support) : {},
44-
]);
39+
const featuresOutput = Object.entries(features).reduce(
40+
(prev: any[], [, feature]) => {
41+
if (feature.kind === "feature" && feature.status?.baseline_low_date) {
42+
prev.push([
43+
feature.status?.baseline_low_date ?? "",
44+
feature.status?.support
45+
? compressSupportObject(feature.status.support)
46+
: {},
47+
]);
48+
}
49+
return prev;
50+
},
51+
[],
52+
);
4553

4654
const bcdBrowserNames: string[] = [
4755
"chrome",
@@ -57,14 +65,14 @@ const bcdBrowserNames: string[] = [
5765
"opera",
5866
];
5967

60-
const engineMapping: object = {
68+
const engineMapping: Record<string, string> = {
6169
WebKit: "w",
6270
Gecko: "g",
6371
Presto: "p",
6472
Blink: "b",
6573
};
6674

67-
const statusMapping: object = {
75+
const statusMapping: Record<string, string> = {
6876
retired: "r",
6977
current: "c",
7078
beta: "b",
@@ -74,7 +82,7 @@ const statusMapping: object = {
7482
esr: "e",
7583
};
7684

77-
const bcdOutput = {};
85+
const bcdOutput: { [key: string]: any } = {};
7886
Object.entries(bcd.browsers).forEach(([browser, data]) => {
7987
if (bcdBrowserNames.includes(browser)) {
8088
let releases = Object.entries(data.releases).map(
@@ -99,7 +107,7 @@ Object.entries(bcd.browsers).forEach(([browser, data]) => {
99107
}
100108
});
101109

102-
const otherOutput = {};
110+
const otherOutput: Record<string, any> = {};
103111
Object.entries(other.browsers).forEach(([browser, data]) => {
104112
let releases = Object.entries(data.releases).map(
105113
([releaseId, releaseData]) => {

0 commit comments

Comments
 (0)