# parse-lcov

> Parse LCOV

Latest version **1.0.4** (published 2020-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install parse-lcov
pnpm add parse-lcov
yarn add parse-lcov
bun add parse-lcov
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-10-06 |
| First published | 2020-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Connor White |
| Maintainers | bconnorwhite |
| Keywords | parse, lcov, coverage, lines, to, json, typed, types, ts, typescript |

## Links

- npm: https://www.npmjs.com/package/parse-lcov
- Repository: https://github.com/bconnorwhite/parse-lcov
- Homepage: https://connorwhite.org/github/parse-lcov
- npm.io page: https://npm.io/package/parse-lcov

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-10-06
- 1.0.2 — 2020-09-29
- 1.0.1 — 2020-09-27
- 1.0.0 — 2020-09-27

## README

<div align="center">
  <h1>parse-lcov</h1>
  <a href="https://npmjs.com/package/parse-lcov">
    <img alt="NPM" src="https://img.shields.io/npm/v/parse-lcov.svg">
  </a>
  <a href="https://github.com/bconnorwhite/parse-lcov">
    <img alt="TypeScript" src="https://img.shields.io/github/languages/top/bconnorwhite/parse-lcov.svg">
  </a>
  <a href="https://coveralls.io/github/bconnorwhite/parse-lcov?branch=master">
    <img alt="Coverage Status" src="https://coveralls.io/repos/github/bconnorwhite/parse-lcov/badge.svg?branch=master">
  </a>
  <a href="https://github.com/bconnorwhite/parse-lcov">
    <img alt="GitHub Stars" src="https://img.shields.io/github/stars/bconnorwhite/parse-lcov?label=Stars%20Appreciated%21&style=social">
  </a>
  <a href="https://twitter.com/bconnorwhite">
    <img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/bconnorwhite.svg?label=%40bconnorwhite&style=social">
  </a>
</div>

<br />

> Parse LCOV.

Full specification: http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php

## Installation

```bash
yarn add parse-lcov
```

```bash
npm install parse-lcov
```

## API

### Usage

```ts
import parseLCOV from "parse-lcov";

const lcov = `
TN:
SF:source/file.ts
FN:5,functionA
FN:8,functionB
...
`;

parseLCOV(lcov);

/* Sample Output:
[{
    title: "",
    file: "source/file.ts",
    functions: {
      found: 2,
      hit: 2,
      details: [{
        line: 5,
        hit: 2,
        name: "functionA"
      }, {
        hit: 16,
        line: 8,
        name: "functionB"
      }]
    },
    branches: {
      found: 3,
      hit: 3,
      details: [{
        block: 0,
        branch: 0,
        line: 5,
        taken: 1
      }, {
        block: 1,
        branch: 0,
        line: 9,
        taken: 0
      }]
    },
    lines: {
      found: 13,
      hit: 13,
      details: [{
        hit: 1,
        line: 1
      }]
    }
  }]);
*/
```

### Types
```ts
import parseLCOV, { LCOVRecord, FunctionsDetails, BranchesDetails, LinesDetails } from "parse-lcov";

function parseLCOV(string?: string): LCOVRecord[];

type LCOVRecord = {
  title: string;
  file: string;
  functions: LCOVStats & {
    details: FunctionsDetails[];
  };
  branches: LCOVStats & {
    details: BranchesDetails[];
  };
  lines: LCOVStats & {
    details: LinesDetails[];
  };
}

type LCOVStats = {
  found: number;
  hit: number;
}

type FunctionsDetails = {
  name: string;
  line: number;
  hit?: number;
}

type BranchesDetails = {
  line: number;
  block: number;
  branch: number;
  taken: number;
};

type LinesDetails = {
  line: number;
  hit: number;
}
```

<br />

<h2>Dev Dependencies<img align="right" alt="David" src="https://img.shields.io/david/dev/bconnorwhite/parse-lcov.svg"></h2>

- [@bconnorwhite/bob](https://www.npmjs.com/package/@bconnorwhite/bob): Bob is a toolkit for TypeScript projects

<br />

<h2>License <img align="right" alt="license" src="https://img.shields.io/npm/l/parse-lcov.svg"></h2>

[MIT](https://opensource.org/licenses/MIT)

<br />

## Related Packages

- [parse-json-object](https://www.npmjs.com/package/parse-json-object): Parse a typed JSON object
- [read-lcov-safe](https://www.npmjs.com/package/read-lcov-safe): Read and parse an lcov file without try catch

---
_Source: https://npm.io/package/parse-lcov · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
