Skip to content

Commit

Permalink
📚 docs: Fix docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Apr 27, 2020
1 parent 9da7d4a commit 9ed6468
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 162 deletions.
128 changes: 4 additions & 124 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[js-mergesort](http://aureooms.github.io/js-mergesort)
[@aureooms/js-mergesort](http://aureooms.github.io/js-mergesort)
==

<img src="https://idea-instructions.com/merge-sort.png" width="864"/>

Mergesort code bricks for JavaScript. Parent is
[aureooms/js-sort](https://github.com/aureooms/js-sort).
Mergesort library for JavaScript.
See [docs](https://aureooms.github.io/js-mergesort/index.html).
Parent is [aureooms/js-sort](https://github.com/aureooms/js-sort).

```js
let sort = mergesort.recursive( merging.tapemerge , array.copy ) ;
Expand All @@ -25,127 +26,6 @@ let sort = mergesort.recursive( merging.tapemerge , array.copy ) ;
[![Documentation](http://aureooms.github.io/js-mergesort//badge.svg)](http://aureooms.github.io/js-mergesort//source.html)
[![Package size](https://img.shields.io/bundlephobia/minzip/@aureooms/js-mergesort)](https://bundlephobia.com/result?p=@aureooms/js-mergesort)


Can be managed through [jspm](https://github.com/jspm/jspm-cli),
[duo](https://github.com/duojs/duo),
[component](https://github.com/componentjs/component),
[bower](https://github.com/bower/bower),
[ender](https://github.com/ender-js/Ender),
[jam](https://github.com/caolan/jam),
[spm](https://github.com/spmjs/spm),
and [npm](https://github.com/npm/npm).

## Install

### jspm
```terminal
jspm install github:aureooms/js-mergesort
# or
jspm install npm:@aureooms/js-mergesort
```
### duo
No install step needed for duo!

### component
```terminal
component install aureooms/js-mergesort
```

### bower
```terminal
bower install @aureooms/js-mergesort
```

### ender
```terminal
ender add @aureooms/js-mergesort
```

### jam
```terminal
jam install @aureooms/js-mergesort
```

### spm
```terminal
spm install @aureooms/js-mergesort --save
```

### npm
```terminal
npm install @aureooms/js-mergesort --save
```

## Require
### jspm
```js
let mergesort = require( "github:aureooms/js-mergesort" ) ;
// or
import mergesort from '@aureooms/js-mergesort' ;
```
### duo
```js
let mergesort = require( "aureooms/js-mergesort" ) ;
```

### component, ender, spm, npm
```js
let mergesort = require( "@aureooms/js-mergesort" ) ;
```

### bower
The script tag exposes the global variable `mergesort`.
```html
<script src="bower_components/@aureooms/js-mergesort/js/dist/mergesort.min.js"></script>
```
Alternatively, you can use any tool mentioned [here](http://bower.io/docs/tools/).

### jam
```js
require( [ "@aureooms/js-mergesort" ] , function ( mergesort ) { ... } ) ;
```


## Use

```js
let array = require( "@aureooms/js-array" ) ;
let compare = require( "@aureooms/js-compare" ) ;
let merging = require( "@aureooms/js-merging" ) ;

/** recursive mergesort */
let sort = mergesort.recursive( merging.tapemerge , array.copy ) ;

/** iterative mergesort */
let sort = mergesort.iterative( merging.tapemerge , array.copy ) ;

// for example

let random = require( "@aureooms/js-random" ) ;

let n = 10 ;
let A = array.alloc( n ) ;
let B = array.alloc( n ) ;

array.iota( A , 0 , n , 0 ) ;

A ; // [ 0 , 1 , ... , 9 ]

random.shuffle( A , 0 , n ) ;

sort( compare.increasing , A , 0 , n , B , 0 , n ) ;

B ; // [ 0 , 1 , ... , 9 ]

// or decreasing

random.shuffle( A , 0 , n ) ;

sort( compare.decreasing , A , 0 , n , B , 0 , n ) ;

B ; // [ 9 , 8 , ... , 0 ]
```

## Reference

- http://sorting.at
40 changes: 20 additions & 20 deletions doc/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,50 @@ h2,
.navigation,
.layout-container > header,
footer
{{
{
border: none;
}}
}

.project-name {{
.project-name {
color: #FC913A;
font-weight: bold;
}}
}

.layout-container > header > a.repo-url-github {{
.layout-container > header > a.repo-url-github {
font-size: inherit;
display: inline;
background: none;
vertical-align: inherit;
}}
}

.search-box img {{
.search-box img {
display: none;
}}
}

.search-box::before{{
.search-box::before{
content: "search";
}}
}

.search-input-edge {{
.search-input-edge {
height: 0px;
}}
}

.search-result {{
.search-result {
width: 300px;
margin-left: 42px;
box-shadow: 1px 1px 13px rgba(0,0,0,0.2);
}}
}

.search-input {{
.search-input {
visibility: visible;
}}
}

.search-result li.search-separator {{
.search-result li.search-separator {
text-transform: capitalize;
background-color: #ccc;
}}
}

span[data-ice="signature"] > span {{
span[data-ice="signature"] > span {
/*font-weight: bold;*/
font-style: italic;
}}
}
41 changes: 40 additions & 1 deletion doc/manual/example.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
# Examples

> More examples in [the test files](https://github.com/{repository}/tree/master/test/src).
> More examples in [the test files](https://github.com/aureooms/js-mergesort/tree/master/test/src).

```js
let array = require( "@aureooms/js-array" ) ;
let compare = require( "@aureooms/js-compare" ) ;
let merging = require( "@aureooms/js-merging" ) ;

/** recursive mergesort */
let sort = mergesort.recursive( merging.tapemerge , array.copy ) ;

/** iterative mergesort */
let sort = mergesort.iterative( merging.tapemerge , array.copy ) ;

// for example

let random = require( "@aureooms/js-random" ) ;

let n = 10 ;
let A = array.alloc( n ) ;
let B = array.alloc( n ) ;

array.iota( A , 0 , n , 0 ) ;

A ; // [ 0 , 1 , ... , 9 ]

random.shuffle( A , 0 , n ) ;

sort( compare.increasing , A , 0 , n , B , 0 , n ) ;

B ; // [ 0 , 1 , ... , 9 ]

// or decreasing

random.shuffle( A , 0 , n ) ;

sort( compare.decreasing , A , 0 , n , B , 0 , n ) ;

B ; // [ 9 , 8 , ... , 0 ]
```
6 changes: 3 additions & 3 deletions doc/manual/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ or [jspm](https://jspm.org/docs).

### yarn
```terminal
yarn add {fullname}
yarn add @aureooms/js-mergesort
```

### npm
```terminal
npm install {fullname} --save
npm install @aureooms/js-mergesort --save
```

### jspm
```terminal
jspm install npm:{fullname}
jspm install npm:@aureooms/js-mergesort
```
4 changes: 2 additions & 2 deletions doc/manual/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import '@babel/polyfill' ;

Then, import the library where needed
```js
const {var} = require( '{fullname}' ) ;
const mergesort = require( '@aureooms/js-mergesort' ) ;
// or
import * as {var} from '{fullname}' ;
import * as mergesort from '@aureooms/js-mergesort' ;
```
24 changes: 12 additions & 12 deletions doc/scripts/header.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
var domReady = function(callback) {{
var domReady = function(callback) {
var state = document.readyState ;
if ( state === 'interactive' || state === 'complete' ) {{
if ( state === 'interactive' || state === 'complete' ) {
callback() ;
}}
else {{
}
else {
document.addEventListener('DOMContentLoaded', callback);
}}
}} ;
}
} ;


domReady(function(){{
domReady(function(){

var projectname = document.createElement('a');
projectname.classList.add('project-name');
projectname.text = '{repository}';
projectname.text = 'aureooms/js-mergesort';
projectname.href = './index.html' ;

var header = document.getElementsByTagName('header')[0] ;
header.insertBefore(projectname,header.firstChild);

var testlink = document.querySelector('header > a[data-ice="testLink"]') ;
testlink.href = 'https://coveralls.io/github/{repository}' ;
testlink.href = 'https://coveralls.io/github/aureooms/js-mergesort' ;
testlink.target = '_BLANK' ;

var searchBox = document.querySelector('.search-box');
var input = document.querySelector('.search-input');

// active search box when focus on searchBox.
input.addEventListener('focus', function(){{
input.addEventListener('focus', function(){
searchBox.classList.add('active');
}});
});

}});
});

0 comments on commit 9ed6468

Please sign in to comment.