UNPKG

common-comment-parser

Version:

A universal comment parser (supports more than 30 languages)

10 lines (8 loc) 342 B
import * as fs from 'fs'; import * as path from 'path'; import parser from './src/index'; const url = './test/static/demo.html'; const extname = path.extname(url); const context = fs.readFileSync(path.join(__dirname, url), 'utf-8'); const comments = parser(context, extname.replace('.', '')); console.log(JSON.stringify(comments, null, 4));