base-reporter
Base application smart plugin for caching data and adding and running custom report functions.
Install
Install with npm:
$ npm install base-reporter --save
Usage
var reporter = ;
API
reporter
Exposes smart plugin for adding a reporter
instance to a base application.
Params
config
{Object}: Configuration object.returns
{Function}: Plugin function to use withapp.use
Example
app;
.reporter.middleware
Creates a middleware function that can be used with application middleware methods.
Params
fn
{String|Function}: Pass a property string or function that will create a middleware function. Defaults tofiles
.returns
{Function}: Function that can be used as a middleware function.
Example
// Default middleware will cache all files on the `reporter.files` array (can be accessed in report functions):app; // Pass a custom property string to cache files on another property:app; // Pass a custom function that creates the middleware function. The function will take the reporter instance:app;
.reporter.add
Add a report function to the reporter with the given name. Function may take the reporter instance and options as parameters.
Params
name
{String}: Name of the reporterfn
{Function}: report function to run when .reporter.report(name) is called.returns
{Object}this
: to enable chaining
Example
appreporter;
.reporter.report
Run a registered report function with the given options.
Params
name
{String}: Name of the report to run.returns
{Object}this
: to enable chaining
Example
appreporter;//=> file1.js,file2.js,file3.js
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Building docs
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Brian Woodward
License
Copyright © 2016, Brian Woodward. Released under the MIT license.
This file was generated by verb, v0.9.0, on June 16, 2016.