Skip to content

Commit

Permalink
Merge pull request #77 from AthennaIO/develop
Browse files Browse the repository at this point in the history
fix(color): adjust spaces of statusCode method
  • Loading branch information
jlenon7 committed Sep 22, 2023
2 parents 39965d8 + 16331b4 commit cbe8b94
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
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

0 comments on commit cbe8b94

Please sign in to comment.