Skip to content

Commit

Permalink
feat: adjust hash function
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 27, 2023
1 parent 5c9c583 commit 074d116
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ declare class Logger {
static formatters: Record<string, Logger.Formatter>

static color(code: number, value: any, decoration?: string): string
static code(name: string): number
static code(name: string, target: Logger.Target): number

public name: string
public level: number
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "reggol",
"description": "Logger for professionals",
"version": "1.6.2",
"version": "1.6.3",
"sideEffects": false,
"main": "lib/node.js",
"types": "index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Logger {
static code(name: string, target: Logger.Target) {
let hash = 0
for (let i = 0; i < name.length; i++) {
hash = ((hash << 3) - hash) + name.charCodeAt(i)
hash = ((hash << 3) - hash) + name.charCodeAt(i) + 13
hash |= 0
}
const colors = !target.colors ? [] : target.colors >= 2 ? c256 : c16
Expand Down

0 comments on commit 074d116

Please sign in to comment.