Skip to content

Commit

Permalink
Merge pull request #4 from v-ut-d/PolinaBalanyeva/avoid-any-and-as
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
PolinaBalanyeva authored Sep 26, 2022
2 parents 6e2a617 + 37b35ad commit 37d0550
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const interval = 60 * 10;
const processing = new Set();
const writing = { id: [0, 0] };
const idJSON = new json('id');
let ids: Record<string, string>, speakers: Record<string, number[]>;
let ids: Record<string, string>;
const speakers: Record<string, number[]> = {};
const intervalIDs: Record<string, number> = {};

const twitter = new TwitterWrap({
Expand Down
6 changes: 3 additions & 3 deletions src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export default class json {
}
public async read<T>(): Promise<Record<string, T>> {
const dict: Record<string, T> = await fs
.access(this.filename + '.json')
.access('data/' + this.filename + '.json')
.then(async () =>
fs.readFile(this.filename + '.json', { encoding: 'utf-8' })
fs.readFile('data/' + this.filename + '.json', { encoding: 'utf-8' })
)
.catch(() => '{}')
.then((data) => JSON.parse(data) as Record<string, T>);
Expand All @@ -28,7 +28,7 @@ export default class json {
writingThisFile[1] = 1;
while (writingThisFile[0] && writingThisFile[0] > 0) {
await fs
.writeFile(this.filename + '.json', JSON.stringify(dict))
.writeFile('data/' + this.filename + '.json', JSON.stringify(dict))
.then(() => {
writingThisFile[0] -= 1;
});
Expand Down

0 comments on commit 37d0550

Please sign in to comment.