Skip to content

Commit bf4b077

Browse files
A5rocksMattIPv4
andauthored
Drop $schema property from lists + legacy IDs (#4)
* Drop schemas * Remove `$schema` from legacy ids * Update src/util/getList.js Co-authored-by: Matt Cowley <me@mattcowley.co.uk> * Linting Co-authored-by: Matt Cowley <me@mattcowley.co.uk>
1 parent d59c1c5 commit bf4b077

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/routes/legacy-ids.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
handler: () => {
77
// Get legacy IDs and sort
88
const map = Object.entries(legacy)
9+
.filter((k) => k[0] !== '$schema')
910
.sort((a, b) => a[0].localeCompare(b[0]) ? -1 : 1)
1011
.reduce((obj, [key, value]) => ({ ...obj, [key]: value }), {});
1112

src/util/getList.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,23 @@ module.exports = id => {
99
const list = { ...match };
1010

1111
// Load full features
12-
list.features = featuresData.map(feature => ({
13-
...feature,
14-
value: list.features.includes(feature.id) ? 1 : 0,
15-
})).sort((a, b) => {
12+
list.features = featuresData.map(feature => {
13+
const withValue = {
14+
...feature,
15+
value: list.features.includes(feature.id) ? 1 : 0,
16+
};
17+
18+
delete withValue['$schema'];
19+
20+
return withValue;
21+
}).sort((a, b) => {
1622
if (a.value !== b.value) return a.value ? -1 : 1;
1723
if (a.display !== b.display) return a.display > b.display ? -1 : 1;
1824
return a.name.localeCompare(b.name) ? -1 : 1;
1925
});
2026

27+
// Drop $schema
28+
delete list['$schema'];
29+
2130
return list;
2231
};

0 commit comments

Comments
 (0)