bun-router 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,19 +15,15 @@ const timestamp = (date: Date) => {
15
15
  }
16
16
 
17
17
  // append ANSI color escape sequences to a string based on the given HTTP status code.
18
- const colorCode = (n: number, text?: string): string => {
18
+ const colorCode = (n: number, text?:string): string => {
19
19
  const s = ` [${String(n)}${text ?? ''}] `;
20
- let backgroundColor = 'bgBlack';
21
- let foregroundColor = 'white';
22
-
23
- if (n < 100) backgroundColor = 'bgYellow';
24
- else if (n < 200) backgroundColor = 'bgCyan';
25
- else if (n < 300) backgroundColor = 'bgGreen';
26
- else if (n < 400) backgroundColor = 'bgRed';
27
- else if (n < 500) backgroundColor = 'bgRed';
28
- else foregroundColor = 'white';
29
-
30
- return color(foregroundColor, backgroundColor, s).trim();
20
+ if (n < 100) return color('black', 'bgYellow', s);
21
+ else if (n >= 100 && n < 200) return color('black', 'bgCyan', s);
22
+ else if (n >= 200 && n < 300) return color('black', 'bgGreen', s);
23
+ else if (n >= 300 && n < 400) return color('black', 'bgRed', s);
24
+ else if (n >= 400 && n < 500) return color('black', 'bgRed', s);
25
+ else if (n >= 500) return color('white', 'bgRed', s);
26
+ return color('white', 'bgBlack', `[${s}]`).trim();
31
27
  }
32
28
 
33
29
 
package/package.json CHANGED
@@ -8,5 +8,5 @@
8
8
  "peerDependencies": {
9
9
  "typescript": "^5.0.0"
10
10
  },
11
- "version": "0.5.3"
11
+ "version": "0.5.4"
12
12
  }