JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 52933
  • Score
    100M100P100Q210796F
  • License MIT

JavaScript/Node.js Csv to Markdown Table Converter

Package Exports

  • csv-to-markdown-table
  • csv-to-markdown-table/lib/CsvToMarkdown
  • csv-to-markdown-table/lib/CsvToMarkdown.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (csv-to-markdown-table) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

CSV To Markdown Table

npm version npm Coverage Status GitHub license

Simple JavaScript CSV to Markdown Table Converter

You can see it in action and play with the Live Example.

Requires no external libraries. Works in Node as well as in the browser.

Install

npm install csv-to-markdown-table

Usage

Raw JS via Global

console.log(
  csvToMarkdown( "header1,header2,header3\nValue1,Value2,Value3", ",", true)
);

Node / npm

const csvToMarkdown = require("csv-to-markdown-table");

console.log(
    csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true)
);

TypeScript

import csvToMarkdown from "csv-to-markdown-table";

console.log(
  csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true)
);

Outputs:

| header1 | header2 | header3 | 
|---------|---------|---------| 
| Value1  | Value2  | Value3  | 

Which displays in markdown as:

header1 header2 header3
Value1 Value2 Value3