Package Exports
- base-extract-comments
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (base-extract-comments) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
base-extract-comments

Base (github @node-base) application plugin for extracting code comments using
acorn-extract-comments.
Install
npm i base-extract-comments --saveUsage
For more use-cases see the tests
const baseExtractComments = require('base-extract-comments')baseExtractComments
Plugin that adds
.extractCommentsmethod to your base application, that extracts JSDoc-style code comments using acorn-extract-comments lib.
Params
opts{Object}: merged withapp.optionsand passed to acorn-extract-commentsreturns{Function}: the actual plugin
Example
var extract = require('base-extract-comments')
var Base = require('base')
var app = new Base({ isApp: true })
app.use(extract({ foo: 'option' }))
console.log(app.extractComments) // => [Function: extractComments].extractComments
Extract code comments from
inputstring and returns an array of comment objects or pass it todonecallback. Notice that.extractCommentshave sync and async mode, so if you do not passdonecallback it will throw or return an Array. You also can passinputto the constructor of your app to thethis.cacheobject such as{ cache: { input: 'some str' } }
Params
input{String|Object|Function}: input string,optionsordonecallbackoptions{Object|Function}: merged withapp.optionsand passed to acorn-extract-comments ordonecallbackdone{Function}: callback function (optional)returns{Array}: an Array of comment objects ordone(null, comments)
Example
// sync mode
app.use(extract())
var comments = app.extractComments('some string')
// => array of comment objects
// or
var app = new Base({ cache: { input: 'foo bar baz' } })
app.use(extract())
var comments = app.extractComments()
// => array of comment objects
// or in async mode
app.use(extract())
app.extractComments('foo bar', function done (err, comments) {
// => `comments` is array of comment objects
})Related
- acorn-extract-comments: Extract JavaScript code comments from a string, using
acorn. Optionally returns the… more | homepage - base-data: adds a
datamethod to base-methods. | homepage - base-plugins-enhanced: Error handling and extras for
.useand.runmethods of your Base… more | homepage - base-plugins: Upgrade's plugin support in base applications to allow plugins to be called… more | homepage
- base: base is the foundation for creating modular, unit testable and highly pluggable… more | homepage
- extract-comments: Uses esprima to extract line and block comments from a string of… more | homepage
- postcore: Processor engine for Post* family like PostCSS, PostHTML and PostJSON. | homepage
- use-ware: Adds sync plugin support to your application. Kinda fork of [use… more | homepage
- use: Easily add plugin support to your node.js application. | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.