{"name":"vfile-statistics","version":"2.0.1","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":"^5.0.0","vfile-message":"^3.0.0"},"devDependencies":{"@types/node":"^18.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.53.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","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},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"89e02204e340f99347cb4c2d8d2cfe57214a9cb7","homepage":"https://github.com/vfile/vfile-statistics#readme","_id":"vfile-statistics@2.0.1","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-W6dkECZmP32EG/l+dp2jCLdYzmnDBIw6jwiLZSER81oR5AHRcVqL+k3Z+pfH1R73le6ayDkJRMk0sutj1bMVeg==","shasum":"2e1adae1cd3a45c1ed4f2a24bd103c3d71e4bce3","tarball":"http://registry-npm.ywwl.com/vfile-statistics/download/vfile-statistics-2.0.1.tgz","fileCount":7,"unpackedSize":11386,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3guvCvmtxLG2cMTwwGUVX9/VQRJjEsGH3eV6hgLqtngIgQY6aNP7+JXglFizA3LI5TiwCnWXB7iaM2vgyDoYiaM0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4R+RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrbWA/8D6eX6kNzdeXn3ZumTvs+vgYbc7nlytdWA7RZaPLkkr8fGDAN\r\n51+bfGipcGtu4HOBSyrt0lnkweSItNFERgODtD4xa0fTtBVKAZQX6wZ0iXtJ\r\nmE+WP1ts2zoPjCeuwk8lQ4KqF60nwefTuYO1/y0y2p8P1+RK+7ge+4pHvrDt\r\nZtkkN0sXT3lDoy0SUtvFpU27ZzsAVV0+pPfYIerClJ5N4vrAjxErZ/Vd8D5D\r\nMM9HRUiRKxa38B6dq18NauczLJVGr/NrwqZR1m1v4gkLL52FmP/YiapSIrFw\r\nlYOxzGpcW8v+NT+QwEKdA+hdaoheHx6LMVeIrkpz1qeQ4SPflVL5RNiLKNUA\r\ngTY0xB+e28soV+aWwGhIGnKkWXIhfYMGg4XLxZkHBUSpyS87j1vQzEEFNwmX\r\nFl2Fzt0NguHTgSNGAQFNxL9aSZIvwnjGHkRqH/pUxmJAezAFQgY/ENtY7fLV\r\nO7rS0xI7I+eifDf0ak9hA/az2uNT3pg1VpbdR4piV0u36dOStI2amh26ZiLG\r\nt6cgt4H/T96rJxIudvGHGWgxvs8jqKJKzOmuUmlcMVRJFZT59vai0jSWUEKH\r\nApoO/vrbCVJ0PR2x5BnFFjHGmyCbSGchitxdQQLddZL93DfGqWID4ZUZRA5t\r\nqmvLswyvLv7W/kA2Gbyq1U9k5ep/4aXnuZ0=\r\n=rwIo\r\n-----END PGP SIGNATURE-----\r\n","size":4111,"noattachment":false,"key":"/vfile-statistics/-/vfile-statistics-2.0.1.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.1_1675698065559_0.5779107081086983"},"_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":1675698065710,"_cnpm_publish_time":1675698065710,"dist-tags":{"latest":"3.0.0"}}