Skip to content

Commit a7db7ba

Browse files
📚 docs(README): Add example.
1 parent ebbdfa6 commit a7db7ba

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ See [docs](https://aureooms.github.io/js-lempel-ziv/index.html).
77
> :warning: The code requires `regeneratorRuntime` to be defined, for instance by importing
88
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
99
10+
```js
11+
import {dict, encode, decode} from '@aureooms/js-lempel-ziv/lz78' ;
12+
[...decode(dict(), encode(dict(), 'abcd'))].join(''); // abcd
13+
```
14+
1015
[![License](https://img.shields.io/github/license/aureooms/js-lempel-ziv.svg)](https://raw.githubusercontent.com/aureooms/js-lempel-ziv/master/LICENSE)
1116
[![Version](https://img.shields.io/npm/v/@aureooms/js-lempel-ziv.svg)](https://www.npmjs.org/package/@aureooms/js-lempel-ziv)
1217
[![Build](https://img.shields.io/travis/aureooms/js-lempel-ziv/master.svg)](https://travis-ci.org/aureooms/js-lempel-ziv/branches)

test/src/readme.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import test from 'ava';
2+
3+
import {dict, encode, decode} from '../../src/lz78';
4+
test('README', (t) => {
5+
const input = 'abcd';
6+
t.is(input, [...decode(dict(), encode(dict(), input))].join(''));
7+
});

0 commit comments

Comments
 (0)