{"id":28608203,"url":"https://github.com/vfile/vfile-statistics","last_synced_at":"2025-10-06T06:26:51.189Z","repository":{"id":10569875,"uuid":"66200718","full_name":"vfile/vfile-statistics","owner":"vfile","description":"utility to count messages per category: failures, warnings, etc","archived":false,"fork":false,"pushed_at":"2023-06-15T10:14:10.000Z","size":84,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-26T21:43:25.656Z","etag":null,"topics":["file","statistics","stats","vfile","vfile-util","virtual"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vfile.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2016-08-21T13:41:01.000Z","updated_at":"2024-05-05T10:43:48.000Z","dependencies_parsed_at":"2024-06-18T17:11:26.391Z","dependency_job_id":null,"html_url":"https://github.com/vfile/vfile-statistics","commit_stats":{"total_commits":88,"total_committers":4,"mean_commits":22.0,"dds":"0.045454545454545414","last_synced_commit":"dec4b5dfce589faf7d7017dafad52cbe99513d39"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/vfile/vfile-statistics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-statistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-statistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-statistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-statistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfile","download_url":"https://codeload.github.com/vfile/vfile-statistics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfile%2Fvfile-statistics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259346983,"owners_count":22843812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file","statistics","stats","vfile","vfile-util","virtual"],"created_at":"2025-06-11T21:40:15.216Z","updated_at":"2025-10-06T06:26:51.074Z","avatar_url":"https://github.com/vfile.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":[],"sub_categories":[],"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\u003cscript type=\"module\"\u003e\n  import {statistics} from 'https://esm.sh/vfile-statistics@3?bundle'\n\u003c/script\u003e\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\u003cVFile\u003e`][vfile], [`Array\u003cVFileMessage\u003e`][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\u003c!-- Definitions --\u003e\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\u0026query=$.size.compressedSize\u0026url=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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfile%2Fvfile-statistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfile%2Fvfile-statistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfile%2Fvfile-statistics/lists"}