Component evidence

toCsv (data/csv.ts)

open-dashboard · src/infra/data/csv.ts · typescript · MIT
files

Framework-agnostic, RFC 4180-compliant CSV serialize/parse/download helpers with full type safety.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/ahpxex/open-dashboard | License: MIT | Copyright 2025 破晓
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * CSV export / import helpers — framework-agnostic, dependency-free, and
 * RFC 4180 compliant. `toCsv`/`parseCsv` are pure (safe on the server); only
 * `downloadCsv` touches the DOM and is guarded for browser-only use.
 *
 * These power the export/import gallery shape (`add-export-import`) and can back
 * a real resource: feed `toCsv(rows, columns)` from a `Repository` list, or hand
 * `parseCsv(text).rows` to a bulk-create server fn after validating each row.
 */

/** A column projection for {@link toCsv}: a header label + how to read the cell. */
export interface CsvColumn<T> {
  /** Header text written to the first CSV line. */
  

... (truncated -- full source via MCP)