Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/onesy-me/diff

Difference algorithm
https://github.com/onesy-me/diff

algorithm algorithms amaui browser diff diff-algorithm difference difference-algorithm javascript js library myers-algorithm node nodejs typescript utils web

Last synced: 10 days ago
JSON representation

Difference algorithm

Awesome Lists containing this project

README

        



onesy logo

onesy Diff


Own implementation of The Myers Difference Algorithm



MIT license    
Production ready    
UMD 3.1kb gzipped    
100% test cov    
Browser and Nodejs


Very simple code    
Modern code    
Junior friendly    
Typescript    
Made with :yellow_heart:


## Getting started

### Add

```sh
yarn add @onesy/diff
```

### Use

```javascript
import OnesyDiff from '@onesy/diff';

// Make a new OnesyDiff instance
// with an optional initial value for options
const onesyDiff = new OnesyDiff();

// Diff
const diff = onesyDiff.diff('aaa', 'aab');

// {
// items: ['r', 2, 'a', 2, 'b']
// }

// Update
onesyDiff.update('aaa', diff);

// 'aab'
```

### Dev

Install

```sh
yarn
```

Test

```sh
yarn test
```

### Prod

Build

```sh
yarn build
```