mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 20:37:21 +00:00
Merge remote-tracking branch 'origin/release/0.10' into feat/add-postgres-and-prepare-others
# Conflicts: # app/package.json # bun.lock
This commit is contained in:
@@ -30,7 +30,7 @@ export class DebugLogger {
|
||||
|
||||
const now = performance.now();
|
||||
const time = this.last === 0 ? 0 : Number.parseInt(String(now - this.last));
|
||||
const indents = " ".repeat(this._context.length);
|
||||
const indents = " ".repeat(Math.max(this._context.length - 1, 0));
|
||||
const context =
|
||||
this._context.length > 0 ? `[${this._context[this._context.length - 1]}]` : "";
|
||||
console.log(indents, context, time, ...args);
|
||||
|
||||
@@ -118,3 +118,17 @@ export function patternMatch(target: string, pattern: RegExp | string): boolean
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function slugify(str: string): string {
|
||||
return (
|
||||
String(str)
|
||||
.normalize("NFKD") // split accented characters into their base characters and diacritical marks
|
||||
// biome-ignore lint/suspicious/noMisleadingCharacterClass: <explanation>
|
||||
.replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block.
|
||||
.trim() // trim leading or trailing whitespace
|
||||
.toLowerCase() // convert to lowercase
|
||||
.replace(/[^a-z0-9 -]/g, "") // remove non-alphanumeric characters
|
||||
.replace(/\s+/g, "-") // replace spaces with hyphens
|
||||
.replace(/-+/g, "-") // remove consecutive hyphens
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user