Skip to content

Commit 38bb3f0

Browse files
📚 docs(README): Add example and remove WIP warning.
1 parent c932a29 commit 38bb3f0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
Topological sorting for JavaScript.
55
See [docs](https://aureooms.github.io/js-topological-sorting/index.html).
66

7-
> :building_construction: Caveat emptor! This is work in progress. Code may be
8-
> working. Documentation may be present. Coherence may be. Maybe.
9-
107
> :warning: The code requires `regeneratorRuntime` to be defined, for instance by importing
118
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
129
10+
```js
11+
// Sort anything that can be iterated over with `for (const [u, v] of ...)`
12+
import {sorted} from '@aureooms/js-topological-sorting';
13+
sorted(["ab", "bc"]); // abc
14+
15+
// Add a comparison function to break ties.
16+
import {increasing} from '@aureooms/js-compare';
17+
sorted(["ab", "cd"], increasing); // acbd
18+
```
19+
1320
[![License](https://img.shields.io/github/license/aureooms/js-topological-sorting.svg)](https://raw.githubusercontent.com/aureooms/js-topological-sorting/main/LICENSE)
1421
[![Version](https://img.shields.io/npm/v/@aureooms/js-topological-sorting.svg)](https://www.npmjs.org/package/@aureooms/js-topological-sorting)
1522
[![Build](https://img.shields.io/travis/aureooms/js-topological-sorting/main.svg)](https://travis-ci.org/aureooms/js-topological-sorting/branches)

0 commit comments

Comments
 (0)