mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 20:47:02 +03:00
Add getService helper function
This commit is contained in:
16
src/utils/getService.ts
Normal file
16
src/utils/getService.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Service } from "../types/segments.model";
|
||||
|
||||
export function getService<T extends string>(...value: T[]): Service {
|
||||
for (const name of value) {
|
||||
if (name) {
|
||||
const service = Object.values(Service).find(
|
||||
(val) => val.toLowerCase() === name.trim().toLowerCase()
|
||||
);
|
||||
if (service) {
|
||||
return service;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Service.YouTube;
|
||||
}
|
||||
Reference in New Issue
Block a user