Files
SponsorBlockServer/src/utils/getService.ts
2021-09-13 14:49:17 +07:00

17 lines
440 B
TypeScript

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;
}