Download data/apps/dokploy/lib/utils.ts from llama1/dokpl0y: direct link, hf CLI and curl.
- Browser
- Download file 876 Bytes
-
https://huggingface.co/datasets/llama1/dokpl0y/resolve/main/data/apps/dokploy/lib/utils.ts
- Command line
-
hf download hf://datasets/llama1/dokpl0y/data/apps/dokploy/lib/utils.ts
-
curl -L -o utils.ts https://huggingface.co/datasets/llama1/dokpl0y/resolve/main/data/apps/dokploy/lib/utils.ts
876 Bytes
| import { type ClassValue, clsx } from "clsx"; | |
| import { twMerge } from "tailwind-merge"; | |
| export function cn(...inputs: ClassValue[]) { | |
| return twMerge(clsx(inputs)); | |
| } | |
| export async function generateSHA256Hash(text: string) { | |
| const encoder = new TextEncoder(); | |
| const data = encoder.encode(text); | |
| const hashBuffer = await crypto.subtle.digest("SHA-256", data); | |
| const hashArray = Array.from(new Uint8Array(hashBuffer)); | |
| return hashArray.map((b) => b.toString(16).padStart(2, "0")).join(""); | |
| } | |
| export function formatTimestamp(timestamp: string | number) { | |
| try { | |
| // Si es un string ISO, lo parseamos directamente | |
| if (typeof timestamp === "string" && timestamp.includes("T")) { | |
| const date = new Date(timestamp); | |
| if (!Number.isNaN(date.getTime())) { | |
| return date.toLocaleString(); | |
| } | |
| } | |
| return "Fecha inválida"; | |
| } catch { | |
| return "Fecha inválida"; | |
| } | |
| } | |