Skip to content

Commit 7aa5ab5

Browse files
committed
Add semicolons and refactor name
1 parent a1f50ed commit 7aa5ab5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/routes/postSkipSegments.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,9 @@ export async function postSkipSegments(req: Request, res: Response): Promise<Res
500500
proxySubmission(req);
501501
}
502502

503-
const unsupportedValue = getUnsupportedService(req.query.service, req.body.service)
504-
if (unsupportedValue) {
505-
return res.status(400).send(`Service is not supported: ${unsupportedValue}`);
503+
const unsupportedService = getUnsupportedService(req.query.service, req.body.service);
504+
if (unsupportedService) {
505+
return res.status(400).send(`Service is not supported: ${unsupportedService}`);
506506
}
507507

508508
// eslint-disable-next-line prefer-const

src/utils/getService.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function getService<T extends string>(...value: T[]): Service {
1616
return Service.YouTube;
1717
}
1818

19-
export function getUnsupportedService<T extends string>(...value: T[]): string | undefined {
19+
export function getUnsupportedService<T extends string>(...value: T[]): string | null {
2020
const serviceByName = Object.values(Service).reduce((acc, serviceName) => {
2121
acc[serviceName.toLowerCase()] = serviceName;
2222

@@ -25,12 +25,12 @@ export function getUnsupportedService<T extends string>(...value: T[]): string |
2525

2626
let unsupportedValue;
2727
for (const name of value) {
28-
const cleanName = name?.trim().toLowerCase()
28+
const cleanName = name?.trim().toLowerCase();
2929
if (cleanName in serviceByName) {
30-
return null
30+
return null;
3131
}
32-
if(cleanName) unsupportedValue = name
32+
if (cleanName) unsupportedValue = name;
3333
}
3434

35-
return unsupportedValue
35+
return unsupportedValue;
3636
}

0 commit comments

Comments
 (0)