Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(color): adjust spaces of statusCode method #77

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/common",
"version": "4.13.0",
"version": "4.13.1",
"description": "The Athenna common helpers to use in any Node.js ESM project.",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
14 changes: 6 additions & 8 deletions src/helpers/Color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,22 @@ export class Color {
*/
public static statusCode(statusCode: number): string {
if (statusCode >= 200 && statusCode < 300) {
return Color.chalk.bgGreen.bold(statusCode)
return Color.chalk.bgGreen.bold(` ${statusCode} `)
}

if (statusCode >= 300 && statusCode < 400) {
return Color.chalk.bgCyan.bold(statusCode)
return Color.chalk.bgCyan.bold(` ${statusCode} `)
}

if (statusCode >= 400 && statusCode < 500) {
return Color.chalk.bgHex('#f18b0e').bold(statusCode)
return Color.chalk.bgHex('#f18b0e').bold(` ${statusCode} `)
}

if (statusCode >= 500) {
return Color.chalk.bgRed.bold(statusCode)
return Color.chalk.bgRed.bold(` ${statusCode} `)
}

return Color.chalk.bgGray.bold(statusCode)
return Color.chalk.bgGray.bold(` ${statusCode} `)
}

/**
Expand All @@ -265,9 +265,7 @@ export class Color {
* Paint by the http method.
*/
public static httpMethod(method: string): string {
const methodToBeExecuted = method.replace(/ /g, '').toUpperCase()

return this[methodToBeExecuted](method)
return this[method](` ${method} `)
}

/**
Expand Down
Loading