vfile-statistics
Count vfile messages per category (fatal, nonfatal, and total).
Installation
npm:
npm install vfile-statistics
Usage
var statistics = require('vfile-statistics');
var vfile = require('vfile');
var file = vfile({path: '~/example.md'});
file.message('This could be better');
file.message('That could be better');
try {
file.fail('This is terribly wrong');
} catch (err) {}
console.log(statistics(file));
Yields:
{ fatal: 1, nonfatal: 2, total: 3 }
API
statistics(file)
Pass a vfile, list of vfiles, or a list of messages
(file.messages
), get counts per category.
License
MIT © Titus Wormer