Skip to content

Commit 0ebaf62

Browse files
committed
[Update] code style
1 parent 878c25d commit 0ebaf62

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

src/api/db/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {IMain, IDatabase, IOptions} from 'pg-promise';
2-
import {dwConfig} from './config';
1+
import { IDatabase, IMain, IOptions } from 'pg-promise';
2+
import { dwConfig } from './config';
33
import * as pgPromise from 'pg-promise';
4-
import {writeKeyToCacheFile} from '../cache';
4+
import { writeKeyToCacheFile } from '../cache';
55
import * as LRU from 'lru-cache';
66

77
export interface IExtensions {
@@ -26,14 +26,15 @@ const options: IOptions<IExtensions> = {
2626
return Promise.resolve(dbCache.get(getQuery));
2727
}
2828
// TODO: cross check
29-
if (process.env.NODE_ENV === 'development') writeKeyToCacheFile(getQuery, 'dw'); // should be an option
29+
if (process.env.NODE_ENV === 'development') { writeKeyToCacheFile(getQuery, 'dw'); } // should be an option
30+
3031
return obj.any(getQuery);
3132
};
3233
},
3334
// caching
3435
receive: (data, _result, event) => {
3536
// cache recieved
36-
if (!dbCache.has(event.query)) dbCache.set(event.query, data);
37+
if (!dbCache.has(event.query)) { dbCache.set(event.query, data); }
3738
}
3839
};
3940

src/modules/refs/global/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ export interface IRegional extends IEntityBasic {
3535
export const getEntities = (): Promise<IEntity[]> => githubGet<IEntity>('global/entity.csv');
3636

3737
export const getEntityBySlugAsync = async (slug: string): Promise<IEntity> => {
38-
const entities: IEntity[] = await getEntities();
39-
const entity: IEntity | undefined = entities.find(obj => obj.slug === slug);
40-
if (!entity) { throw new Error (`failed to githubGet entity for ${slug}`); }
41-
return entity;
38+
const entities: IEntity[] = await getEntities();
39+
const entity: IEntity | undefined = entities.find(obj => obj.slug === slug);
40+
if (!entity) {
41+
throw new Error(`failed to githubGet entity for ${slug}`);
42+
}
43+
44+
return entity;
4245
};
4346

4447
export const getEntityByIdAsync = async (id: string): Promise<IEntity> => {

0 commit comments

Comments
 (0)