File size: 755 Bytes
4cadbaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<a href="http://hapijs.com"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a>

# @hapi/topo

Topological sorting with grouping support.

[![Build Status](https://secure.travis-ci.org/hapijs/topo.svg?branch=master)](http://travis-ci.org/hapijs/topo)

## Usage

See the [API Reference](API.md)

**Example**
```js

const Topo = require('topo');



const morning = new Topo();



morning.add('Nap', { after: ['breakfast', 'prep'] });



morning.add([

    'Make toast',

    'Pour juice'

], { before: 'breakfast', group: 'prep' });



morning.add('Eat breakfast', { group: 'breakfast' });



morning.nodes;        // ['Make toast', 'Pour juice', 'Eat breakfast', 'Nap']

```