[READ-ONLY] a fast, modern browser for the npm registry
at main 20 lines 574 B view raw
1export function toIsoDateString(date: Date): string { 2 const year = date.getUTCFullYear() 3 const month = String(date.getUTCMonth() + 1).padStart(2, '0') 4 const day = String(date.getUTCDate()).padStart(2, '0') 5 return `${year}-${month}-${day}` 6} 7 8const htmlEntities: Record<string, string> = { 9 '&amp;': '&', 10 '&lt;': '<', 11 '&gt;': '>', 12 '&quot;': '"', 13 '&#39;': "'", 14 '&apos;': "'", 15 '&nbsp;': ' ', 16} 17 18export function decodeHtmlEntities(text: string): string { 19 return text.replace(/&(?:amp|lt|gt|quot|apos|nbsp|#39);/g, match => htmlEntities[match] || match) 20}