initial commit

This commit is contained in:
Caleb Webber 2024-03-06 16:28:10 -05:00
commit b969ad8689
3 changed files with 29 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.csv
*.json

4
README.md Normal file
View file

@ -0,0 +1,4 @@
```shell
bun convert.js ./path/to/csv
```

23
convert.js Normal file
View file

@ -0,0 +1,23 @@
const file = Bun.file('./data.csv');
const results = {};
for (const line of (await file.text()).split('\n').slice(1)) {
if (line.trim() === '') {
continue;
};
const [industry, market, worker_rating, active_members, show_rate] = line.replaceAll('%', '').split(',');
if (!results[industry]) {
results[industry] = {}
}
if (!results[industry][market]) {
results[industry][market] = {}
}
results[industry][market] = {
worker_rating,
active_members,
show_rate
};
}
console.log(JSON.stringify(results, null, 3));