Skip to content

Commit 52f4239

Browse files
committed
chore: run autoformat
1 parent d7127aa commit 52f4239

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/index.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
export type DetectedInfoType = 'browser' | 'node' | 'bot-device' | 'bot' | 'react-native';
1+
export type DetectedInfoType =
2+
| 'browser'
3+
| 'node'
4+
| 'bot-device'
5+
| 'bot'
6+
| 'react-native';
27

38
interface DetectedInfo<
49
T extends DetectedInfoType,
510
N extends string,
611
O,
712
V = null
8-
> {
13+
> {
914
readonly type: T;
1015
readonly name: N;
1116
readonly version: V;
@@ -19,7 +24,7 @@ export class BrowserInfo
1924
public readonly name: Browser,
2025
public readonly version: string,
2126
public readonly os: OperatingSystem | null,
22-
) { }
27+
) {}
2328
}
2429

2530
export class NodeInfo
@@ -28,19 +33,19 @@ export class NodeInfo
2833
public readonly name: 'node' = 'node';
2934
public readonly os: NodeJS.Platform = process.platform;
3035

31-
constructor(public readonly version: string) { }
36+
constructor(public readonly version: string) {}
3237
}
3338

3439
export class SearchBotDeviceInfo
3540
implements
36-
DetectedInfo<'bot-device', Browser, OperatingSystem | null, string> {
41+
DetectedInfo<'bot-device', Browser, OperatingSystem | null, string> {
3742
public readonly type = 'bot-device';
3843
constructor(
3944
public readonly name: Browser,
4045
public readonly version: string,
4146
public readonly os: OperatingSystem | null,
4247
public readonly bot: string,
43-
) { }
48+
) {}
4449
}
4550

4651
export class BotInfo implements DetectedInfo<'bot', 'bot', null, null> {
@@ -57,7 +62,7 @@ export class ReactNativeInfo
5762
public readonly name: 'react-native' = 'react-native';
5863
public readonly version: null = null;
5964
public readonly os: null = null;
60-
};
65+
}
6166

6267
export type Browser =
6368
| 'aol'
@@ -188,7 +193,13 @@ const operatingSystemRules: OperatingSystemRule[] = [
188193

189194
export function detect(
190195
userAgent?: string,
191-
): BrowserInfo | SearchBotDeviceInfo | BotInfo | NodeInfo | ReactNativeInfo | null {
196+
):
197+
| BrowserInfo
198+
| SearchBotDeviceInfo
199+
| BotInfo
200+
| NodeInfo
201+
| ReactNativeInfo
202+
| null {
192203
if (!!userAgent) {
193204
return parseUserAgent(userAgent);
194205
}

0 commit comments

Comments
 (0)