Skip to content

Commit

Permalink
docs(associative): fix/update readme examples
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 2, 2019
1 parent f25da62 commit 58f5adf
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/associative/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ map = new assoc.SortedMap([
]);
// SortedMap { 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 }

// forward selection w/ given start key
// all entries
[...map.entries()]
// [ [ 'd', 4 ], [ 'c', 3 ], [ 'b', 2 ], [ 'a', 1 ] ]

// range query w/ given start key
// also works with `keys()` and `values()`
[...map.entries("c")]
// [ [ 'c', 3 ], [ 'd', 4 ] ]
Expand All @@ -194,13 +198,9 @@ map = new assoc.SortedMap([
[...map.entries("cc")]
// [ [ 'd', 4 ] ]

// reverse order
[...map.entries(undefined, true)]
// [ [ 'd', 4 ], [ 'c', 3 ], [ 'b', 2 ], [ 'a', 1 ] ]

// reverse order from start key
// range query w/ given MAX key
[...map.entries("c", true)]
// [ [ 'c', 3 ], [ 'b', 2 ], [ 'a', 1 ] ]
// [ [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ] ]
```

### SortedSet
Expand All @@ -220,14 +220,16 @@ This set uses a `SortedMap` as backing store.

## Usage examples

TODO... Please see
[tests](https://github.com/thi-ng/umbrella/tree/master/packages/associative/test/)
and documentation in source code for now...
Please see these packages for use cases:

- [@thi.ng/cache](https://github.com/thi-ng/umbrella/tree/master/packages/cache)
- [@thi.ng/dgraph](https://github.com/thi-ng/umbrella/tree/master/packages/dgraph)
- [@thi.ng/rstream-query](https://github.com/thi-ng/umbrella/tree/master/packages/rstream-query)

## Authors

- Karsten Schmidt

## License

© 2017 - 2018 Karsten Schmidt // Apache Software License 2.0
© 2017 - 2019 Karsten Schmidt // Apache Software License 2.0

0 comments on commit 58f5adf

Please sign in to comment.