-
Notifications
You must be signed in to change notification settings - Fork 10
/
clean.js
50 lines (25 loc) · 891 Bytes
/
clean.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
41
42
43
44
45
46
47
48
49
50
const fs = require('fs')
const path = require('path')
const fetch = require('node-fetch');
/*
isocodes = fs.readFileSync('desc.json').toString();
isocodes = JSON.parse(isocodes)
somej = {}
for(let [key, value] of Object.entries(isocodes)){
somej[key] = value+' \n '+'https://fawazahmed0.github.io/donate.html'
}
fs.writeFileSync('description.json', JSON.stringify(somej))
*/
isocodes = fs.readFileSync(path.join('tags','1.json')).toString();
isocodes = JSON.parse(isocodes)
let somejson = {}
for(let filename of fs.readdirSync('tags')){
jbl = fs.readFileSync(path.join('tags',filename)).toString();
jbl = JSON.parse(jbl)
for(const [key,value] of Object.entries(jbl)){
if(!somejson[key])
somejson[key]=[]
somejson[key] = somejson[key].concat(value)
}
}
fs.writeFileSync('tags.json', JSON.stringify(somejson))