Skip to main content

@std/csv@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
type alias Column

The most essential aspect of a column is accessing the property holding the data for that column on each object in the data array. If that member is at the top level, Column can simply be a property accessor, which is either a string (if it's a plain object) or a number (if it's an array).

const columns = [
  "name",
];

Each property accessor will be used as the header for the column:

name
Deno
  • If the required data is not at the top level (it's nested in other objects/arrays), then a simple property accessor won't work, so an array of them will be required.

    const columns = [
      ["repo", "name"],
      ["repo", "org"],
    ];
    

    When using arrays of property accessors, the header names inherit the value of the last accessor in each array:

    name org
    deno denoland
  • If a different column header is desired, then a ColumnDetails object type can be used for each column:

  • header?: string is the optional value to use for the column header name

  • prop: PropertyAccessor | PropertyAccessor[] is the property accessor (string or number) or array of property accessors used to access the data on each object

const columns = [
  "name",
  {
    prop: ["runsOn", 0],
    header: "language 1",
  },
  {
    prop: ["runsOn", 1],
    header: "language 2",
  },
];
name language 1 language 2
Deno Rust TypeScript

Definition

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/csv

Import symbol

import { type Column } from "@std/csv/stringify";
or

Import directly with a jsr specifier

import { type Column } from "jsr:@std/csv/stringify";