UNPKG

leafdoc

Version:

A lightweight NaturalDocs-like LeafletJS-style documentation generator

22 lines (15 loc) 654 B
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var mec = _interopDefault(require('multilang-extract-comments')); // Generic parser, depends on multiline-extract-comments and returns a simplified // version of the comments data structure function multilangParser(str, filename) { var mecBlocks = mec(str, {filename: filename || 'leafdoc_tmp.js'}); var blocks = Object.values(mecBlocks).map(function (mecBlock) { return mecBlock.content.trim(); }).filter(function (block) { return block && block !== ''; }); return blocks; } module.exports = multilangParser;