@openinf/util-md-table
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

@openinf/util-md-table

Common Markdown table-related utilities


view on npm License: MIT


The high-level goal of @openinf/util-md-table is to serve as a Node.js package containing utilities for common operations on Markdown tables allowing users to make use of them in new ways. As is the case with any software project in continuous development, omissions and errors may exist, for which contributions are welcome.




Installation

@openinf/util-md-table runs on Node.js and is available via npm.

npm install @openinf/util-md-table

Usage

import { mdTable2json } from '@openinf/util-md-table';

const sampleTable = [
'| Col1  | Col2  | Col3  | Col4  |',
'|:-----:|:-----:|:-----:|:-----:|',
'| one   | two   | three | four  |',
'| Fee   | Fie   | Foe   | Fum   |',
].join('\n');

const sampleTableObject = mdTbl2json(sampleTable, (v) => v.toLowerCase());

console.log(sampleTableObject);
[
  { col1: 'one', col2: 'two', col3: 'three', col4: 'four' },
  { col1: 'fee', col2: 'fie', col3: 'foe', col4: 'fum' }
]



mdTbl2json(mdTbl, cellTransform, attribCellTransform) ⇒ Array.<Object>

Kind: global function

Param Type Description
mdTbl string A markdown table as a string.
cellTransform function | undefined A function run on contents of each cell.
attribCellTransform function | undefined A transform only for attribute cells.



© The OpenINF Authors

Package Sidebar

Install

npm i @openinf/util-md-table

Weekly Downloads

0

Version

1.1.3

License

MIT

Unpacked Size

10.5 kB

Total Files

8

Last publish

Collaborators

  • dereknongeneric