# apps/web/src/utils
dir: apps/web/src/utils

index: apps/web/src/utils/.pi-map.index.md

## role
Provides shared utility functions for error handling, icon type definitions, syntax highlighting language mapping, and relative time formatting across the web application.
## files
- errors.ts | Extracts a human-readable error message from an unknown error object, specifically handling axios-style errors with string or array detail fields | exp: extractErrorMessage
- icons.ts | Re-exports the IconName type from the icon component for external consumption | dep: ../components/icon
- language.ts | Maps file extensions to Prism.js language identifiers and provides utilities for syntax highlighting with lazy language loading. | exp: detectLanguage, highlightCode, loadLanguage | dep: prismjs
- time.ts | Formats a date string into a human-readable relative time string (e.g., "2h ago", "3d ago") | exp: func:formatRelativeTime(dateStr: string) → string, call:Math.max, call:Math.floor, call:now.getTime, call:date.getTime
## arch
Lightweight functional utilities organized by domain concern with no internal dependencies, using pattern matching (error types), lazy loading (language imports), and pure string/date transformations.
## tags
time, language, error, message, errors, string, relative, human
## symbols
- formatRelativeTime
- extractErrorMessage
- detectLanguage
- highlightCode
- loadLanguage
- call:Math.max
- call:Math.floor
- call:now.getTime
## workflows
- change utils behavior
  read: errors.ts, icons.ts, language.ts
## dirty
-
