0.1.5 • Published 7 years ago

baumhaus v0.1.5

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

baumhaus

A simple package for parsing different file formats to an abstract syntax tree based on the MIME type detected.

Installation

npm install baumhaus

Usage

const baumhaus = require('baumhaus');
const path = require('path');
const base = path.join(__dirname, 'input');
const css = path.join(base, 'styles.css');
const md = path.join(base, 'markdown.md');
const js = path.join(base, 'scripts.js');
const xml = path.join(base, 'document.xml');
const json = path.join(base, 'document.json');

(async () => {
  const astCSS = await baumhaus.parse(css);
  const astMD = await baumhaus.parse(md);
  const astJS = await baumhaus.parse(js);
  const astXML = await baumhaus.parse(xml);
  const astJSON = await baumhaus.parse(json);
})();

Supported formats

  • JavaScript (using esprima)
  • CSS (using postcss)
  • XML (using xml2js)
  • Markdown (using marked)
  • JSON (using native JSON.parse())
0.1.5

7 years ago

0.1.4

7 years ago

0.1.2

7 years ago