feat: storage and token limiting

This commit is contained in:
Vasily Zubarev
2025-04-21 13:50:45 +02:00
parent 62bad46e58
commit 73e83221b8
25 changed files with 232 additions and 65 deletions

View File

@@ -2,12 +2,14 @@ import { clsx, type ClassValue } from "clsx"
import slugify from "slugify"
import { twMerge } from "tailwind-merge"
const LOCALE = "en-US"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function formatCurrency(total: number, currency: string) {
return new Intl.NumberFormat("en-US", {
return new Intl.NumberFormat(LOCALE, {
style: "currency",
currency: currency,
minimumFractionDigits: 2,
@@ -28,6 +30,12 @@ export function formatBytes(bytes: number) {
return `${parseFloat(value.toFixed(2))} ${sizes[i]}`
}
export function formatNumber(number: number) {
return new Intl.NumberFormat(LOCALE, {
useGrouping: true,
}).format(number)
}
export function codeFromName(name: string, maxLength: number = 16) {
const code = slugify(name, {
replacement: "_",