# lcs-diff

> A tool to compare the difference between two lists

Latest version **1.0.5** (published 2020-01-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install lcs-diff
pnpm add lcs-diff
yarn add lcs-diff
bun add lcs-diff
```

## 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.5 |
| Published | 2020-01-17 |
| First published | 2020-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 505.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | liaokai |
| Maintainers | liaokaime |
| Keywords | lcs-diff, 差异, 文本对比 |

## Links

- npm: https://www.npmjs.com/package/lcs-diff
- Repository: https://github.com/liaokaime/lcs-diff
- Homepage: https://github.com/liaokaime/lcs-diff#readme
- Issues: https://github.com/liaokaime/lcs-diff/issues
- npm.io page: https://npm.io/package/lcs-diff

## Recent versions

- 1.0.5 (latest) — 2020-01-17
- 1.0.4 — 2020-01-11
- 1.0.3 — 2020-01-02
- 1.0.2 — 2020-01-02
- 1.0.1 — 2020-01-02
- 1.0.0 — 2020-01-02

## README

# lcs-diff
A tool to compare the difference between two lists

# Example
Preview link [https://liaokaime.github.io/lcs-diff/](https://liaokaime.github.io/lcs-diff/)

# Installation
```
npm i lcs-diff
```

# Usage
```typescript
import {LCS} from "lcs-diff/dist";

let lcs =new LCS({
    content : {
        listA : ["a","b","c","d"],
        listB : ["b","c","d","e"],
    },
    compare : (t1,t2)=>{
        return t1 === t2
    }
});

/**
 * Gets the difference between two pieces of text.
 *   The return value is an array with 3 keys for each element.
 *   "unitA" and "unitB" are elements from listA and listB, When "unitA" or "unitB" do not match element from another list, they may be undefined.
 *   "equals" indicates whether "unitA" and "unitB" are the same
 *   {
 *       unitA : T | undefined,
 *       unitB : T | undefined,
 *       equals : boolean
 *   }
 */
let compareList = lcs.getDiff();

/**
 * Gets the similarity between the contents of the two lists
 * This is a number between 0 and 1
 */
let similarity = lcs.getSimilarity();
```

# License
The files included in this repository are licensed under the MIT license.

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