Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
markdown-tables-to-json
Advanced tools
Extracts tables from Markdown documents and converts to JSON objects.
This is a module for extracting tables from Markdown documents and converting them to string arrays or JSON objects.
The following code snippet demonstrates the basic usage of the module and the difference between 'rows'
and 'columns'
modes. Take a look at src/index.ts for additional static methods available.
// import the table extractor
var { Extractor } = require('markdown-tables-to-json');
// markdown string with a row-oriented table
let md_rows = `
| Name | Head | Body | Tail | Paws |
|----------|-------|-------|-------|-------|
| Mittens | BLACK | black | black | white |
| Dipstick | white | white | black | white |
| Snow | white | white | white | white |
`
// markdown string with a column-oriented table
let md_cols = `
| Name | Mittens | Dipstick | Snow |
|------|---------|----------|-------|
| Head | BLACK | white | white |
| Body | black | white | white |
| Tail | black | black | white |
| Paws | white | white | white |
`
// leave the case of the keys alone
console.log(Extractor.extractObject(md_rows, 'rows', false));
// make all the keys lowercase
console.log(Extractor.extractObject(md_cols, 'columns', true));
// unmodified case
{
Mittens: { Head: 'BLACK', Body: 'black', Tail: 'black', Paws: 'white' },
Dipstick: { Head: 'white', Body: 'white', Tail: 'black', Paws: 'white' },
Snow: { Head: 'white', Body: 'white', Tail: 'white', Paws: 'white' }
}
// all keys lowercase
{
mittens: { head: 'BLACK', body: 'black', tail: 'black', paws: 'white' },
dipstick: { head: 'white', body: 'white', tail: 'black', paws: 'white' },
snow: { head: 'white', body: 'white', tail: 'white', paws: 'white' }
}
FAQs
Extracts tables from Markdown documents and converts to JSON objects.
The npm package markdown-tables-to-json receives a total of 0 weekly downloads. As such, markdown-tables-to-json popularity was classified as not popular.
We found that markdown-tables-to-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.