Skip to content

Commit 8fb4e51

Browse files
📚 docs(README): Add example.
1 parent 587058d commit 8fb4e51

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ See [docs](https://aureooms.github.io/js-persistent-stack/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 {empty, from, isEmpty, push, pop, peek, iter} from '@aureooms/js-persistent-stack';
12+
let stack = from('abc');
13+
let values = [...iter(stack)].join(''); // cba
14+
...
15+
```
16+
1017
[![License](https://img.shields.io/github/license/aureooms/js-persistent-stack.svg)](https://raw.githubusercontent.com/aureooms/js-persistent-stack/master/LICENSE)
1118
[![Version](https://img.shields.io/npm/v/@aureooms/js-persistent-stack.svg)](https://www.npmjs.org/package/@aureooms/js-persistent-stack)
1219
[![Build](https://img.shields.io/travis/aureooms/js-persistent-stack/master.svg)](https://travis-ci.org/aureooms/js-persistent-stack/branches)

test/src/readme.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import test from 'ava';
2+
3+
import {from, iter} from '../../src';
4+
5+
test('readme', (t) => {
6+
const stack = from('abc');
7+
const values = [...iter(stack)].join('');
8+
t.is('cba', values);
9+
});

0 commit comments

Comments
 (0)