-
-
Notifications
You must be signed in to change notification settings - Fork 201
/
Copy pathsubmission.js
41 lines (36 loc) · 1.23 KB
/
submission.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const fs = require('fs');
const data = require('./data.json')
const submission = require('./submission.json')
function removeEmptyKeys(obj) {
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => !!value))
}
function cleanTags(arr) {
return arr.filter(Boolean);
}
data.push(removeEmptyKeys({
name: submission.name,
description: submission.description,
source: submission.source,
tags: cleanTags([
submission.code && 'code',
submission.codereview && 'codereview',
submission.comments && 'comments',
submission.ide && 'ide',
submission.miscellaneous && 'miscellaneous',
submission.navigation && 'navigation',
submission.newsfeed && 'newsfeed',
submission.notifications && 'notifications',
submission.profile && 'profile',
submission.pull_request && 'pullrequest',
submission.repository && 'repository',
submission.search && 'search',
submission.theme && 'theme',
]),
store: removeEmptyKeys({
chrome: submission.chrome,
firefox: submission.firefox,
edge: submission.edge,
opera: submission.opera,
})
}))
fs.writeFileSync('data.json', JSON.stringify(data, null, ' '))