Skip to content

Commit

Permalink
fix: Change Modifier type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
angelnext committed Mar 4, 2024
1 parent 7fe2184 commit eddf8c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@rubiks/rubiks",
"version": "1.2.0",
"version": "1.2.1",
"exports": "./mod.ts"
}
13 changes: 7 additions & 6 deletions modifiers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Level } from "./levels.ts";
import { type Rubiks } from "./rubiks.ts";

export type Modifier = (self: Rubiks) => Level
export type Modifier = (self: Rubiks) => Level;

interface NerdIconsModifierOptions {
error?: boolean;
Expand Down Expand Up @@ -49,15 +49,16 @@ export function nerdIcons(
/**
* Modifier that adds a date to the start of every log.
* @param self - The instance
* @returns A fuction to be executed in every log or null
* @returns The level that modifies the dates
*/
export function withDates(self: Rubiks): Level | null {
export function withDates(self: Rubiks): Level {
const c = self.prefixes.all || "";
return (self: Rubiks, _) => {
const d = new Date();

self.prefixes.all = `${c}${self.noColor ? "" : "\x1b[90m"
}[${d.toLocaleDateString()} ${d.toLocaleTimeString()}]\x1b[0m `;
self.prefixes.all = `${c}${
self.noColor ? "" : "\x1b[90m"
}[${d.toLocaleDateString()} ${d.toLocaleTimeString()}]\x1b[0m `;
};
}

Expand All @@ -66,7 +67,7 @@ export function withDates(self: Rubiks): Level | null {
* @param self - The instance
* @returns A fuction to be executed in every log or null
*/
export function noColor(self: Rubiks): Level | null {
export function noColor(self: Rubiks): null {
self.noColor = true;
return null;
}

0 comments on commit eddf8c6

Please sign in to comment.