mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
feat: storage and token limiting
This commit is contained in:
10
lib/utils.ts
10
lib/utils.ts
@@ -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: "_",
|
||||
|
||||
Reference in New Issue
Block a user