Files
stats/apps/sdk-api/src/bots/index.ts
Carl-Gerhard Lindesvärd 9c92803c4c a looooot
2024-02-22 21:50:30 +01:00

20 lines
302 B
TypeScript

import bots from './bots';
export function isBot(ua: string) {
const res = bots.find((bot) => {
if (new RegExp(bot.regex).test(ua)) {
return true;
}
return false;
});
if (!res) {
return null;
}
return {
name: res.name,
type: res.category || 'Unknown',
};
}