{"name":"vfile-statistics","version":"2.0.0","description":"vfile utility to count messages per category: failures, warnings, etc","license":"MIT","keywords":["vfile","vfile-util","util","utility","virtual","file","message","count","statistics"],"repository":{"type":"git","url":"git+https://github.com/vfile/vfile-statistics.git"},"bugs":{"url":"https://github.com/vfile/vfile-statistics/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},{"name":"Brendan Abbott","email":"brendan.abbott@temando.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"vfile-message":"^3.0.0"},"devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^9.0.0","remark-preset-wooorm":"^8.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","vfile":"^5.0.0","xo":"^0.39.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"no-var":"off","prefer-arrow-callback":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"a8c8c4292cfb0d0737e1a0a729f7a82783ab87f7","homepage":"https://github.com/vfile/vfile-statistics#readme","_id":"vfile-statistics@2.0.0","_nodeVersion":"15.11.0","_npmVersion":"7.11.1","dist":{"integrity":"sha512-foOWtcnJhKN9M2+20AOTlWi2dxNfAoeNIoxD5GXcO182UJyId4QrXa41fWrgcfV3FWTjdEDy3I4cpLVcQscIMA==","shasum":"f04ee3e3c666809a3c10c06021becd41ea9c8037","tarball":"http://registry-npm.ywwl.com/vfile-statistics/download/vfile-statistics-2.0.0.tgz","fileCount":5,"unpackedSize":8910,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkqZZCRA9TVsSAnZWagAAwWsP/i7vA/IObX0c3+S+78zL\n25QFl1WyxcFpovSP2BHUgGlYK4u2VkbzKtSaduHiHFl2l9B0eSOkJ9u9vZkX\nup6SUdOUFYdIzitMNmBCKm54raf6YBcrVBu/fAREvRnj6kkoufF0ck5He+Qa\nV5TDArAS3DRnNxrD1sMbYB1sE1IMDwa3kAbeL+ToFyW66N19++aGAh3swF9a\nHGzx1f1G4iM/kXih0dBZyf+blzhc+fMghE9npqVzzP+tLlTi3M+5AqjJFKRf\nUr42b3bj9Ypn6kqBkTxnOrThFFPsdAPYD7rE9/mwnl4xgW0XqMLqPi8mYLSz\nLI4WcWT2CAjMpFkq2uJOXmU7xt3HvfnU85C2U9lXEfyNl+Py4WRh/3xfKboH\n9eBD2Bfz9bHyYlyz96eNGwkSoCI7UXUjQSsnfAZ0NyZXYS+xWqIy8fN5ywVw\n2N5pxoOL7NLtcpZC05jjjw4yukSAZBI6gVmKLm9sU76nLKKZ/VFoiFgjDzZs\n+wMl6QLJoofV2YnANqdNP3H+WicricL3KwI6uEUFw4ag6dZmR6Kmt1VNlrdI\n9oMYEN+YzqbHhHHKEPOdQiFMZKJWt8ZRPpBVSV9GTDMzwK6DTm1A+Vzuj1vU\n7a5mdZsjxX+J/QKCLtPaCZRcd0M2bVDK437235JfKZUPYNWFzqI8+M2KcUc7\nLmA3\r\n=A8NG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH/UlfDqmYtVy8frSI9FcG93RgSl+4lkUb9VqIrz1MdBAiEA5K9yMKYgy/NbT5yQRDLRAvYNnF2coSATyBmB13vrMqg="}],"size":3432,"noattachment":false,"key":"/vfile-statistics/-/vfile-statistics-2.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vfile-statistics_2.0.0_1620223576853_0.4530653741868542"},"_hasShrinkwrap":false,"readme":"# vfile-statistics\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[vfile][] utility to count messages per category (fatal, warn, info, etc).\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`statistics(file)`](#statisticsfile)\n    *   [`Statistics`](#statistics)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis tiny package gives you stats about messages in files.\n\n## When should I use this?\n\nThis is really tiny, you could do it yourself, but this is useful as a building\nblock.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install vfile-statistics\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {statistics} from 'https://esm.sh/vfile-statistics@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {statistics} from 'https://esm.sh/vfile-statistics@3?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {VFile} from 'vfile'\nimport {statistics} from 'vfile-statistics'\n\nconst file = new VFile({path: '~/example.md'})\n\nfile.message('This could be better')\nfile.message('That could be better')\n\ntry {\n  file.fail('This is terribly wrong')\n} catch {}\n\nfile.info('This is perfect')\n\nconsole.log(statistics(file))\n```\n\nYields:\n\n```js\n{fatal: 1, nonfatal: 3, warn: 2, info: 1, total: 4}\n```\n\n## API\n\nThis package exports the identifier [`statistics`][api-statistics].\nThere is no default export.\n\n### `statistics(file)`\n\nGet stats for a file, list of files, or list of messages.\n\n###### Parameters\n\n*   `file` ([`Array<VFile>`][vfile], [`Array<VFileMessage>`][vfile-message],\n    `VFile`, or `VFileMessage`)\n    — file, message, or list of files or messages\n\n###### Returns\n\nStatistics ([`Statistics`][api-statistics-map]).\n\n### `Statistics`\n\nStatistics (TypeScript type).\n\n###### Fields\n\n*   `fatal` — fatal errors (`fatal: true`)\n*   `warn` — warning messages (`fatal: false`)\n*   `info` — informational messages (`fatal: undefined`)\n*   `nonfatal` — warning or info messages\n*   `total` — all messages\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Statistics`][api-statistics-map].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `vfile-statistics@^3`,\ncompatible with Node.js 16.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to\nget started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/vfile/vfile-statistics/workflows/main/badge.svg\n\n[build]: https://github.com/vfile/vfile-statistics/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-statistics.svg\n\n[coverage]: https://codecov.io/github/vfile/vfile-statistics\n\n[downloads-badge]: https://img.shields.io/npm/dm/vfile-statistics.svg\n\n[downloads]: https://www.npmjs.com/package/vfile-statistics\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=vfile-statistics\n\n[size]: https://bundlejs.com/?q=vfile-statistics\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/vfile/vfile/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[contributing]: https://github.com/vfile/.github/blob/main/contributing.md\n\n[support]: https://github.com/vfile/.github/blob/main/support.md\n\n[health]: https://github.com/vfile/.github\n\n[coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[vfile]: https://github.com/vfile/vfile\n\n[vfile-message]: https://github.com/vfile/vfile-message\n\n[api-statistics]: #statisticsfile\n\n[api-statistics-map]: #statistics\n","publish_time":1620223577000,"_cnpm_publish_time":1620223577000,"dist-tags":{"latest":"3.0.0"}}