Skip to content

Commit 730058a

Browse files
📚 docs: Fix.
1 parent 060c808 commit 730058a

File tree

6 files changed

+103
-183
lines changed

6 files changed

+103
-183
lines changed

README.md

Lines changed: 3 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
[js-compare](http://aureooms.github.io/js-compare)
1+
[@aureooms/js-compare](http://aureooms.github.io/js-compare)
22
==
33

4-
Comparison code bricks for JavaScript.
4+
Comparison library for JavaScript.
5+
See [docs](https://aureooms.github.io/js-compare/index.html).
56

67
```js
78
let compare = reverse( lexicographical( increasing ) ) ;
@@ -23,149 +24,6 @@ compare( [ 1 , 1 ] , [ 1 , 2 ] ) > 0 ; // true
2324
[![Documentation](http://aureooms.github.io/js-compare//badge.svg)](http://aureooms.github.io/js-compare//source.html)
2425
[![Package size](https://img.shields.io/bundlephobia/minzip/@aureooms/js-compare)](https://bundlephobia.com/result?p=@aureooms/js-compare)
2526

26-
Can be managed through [jspm](https://github.com/jspm/jspm-cli),
27-
[duo](https://github.com/duojs/duo),
28-
[component](https://github.com/componentjs/component),
29-
[bower](https://github.com/bower/bower),
30-
[ender](https://github.com/ender-js/Ender),
31-
[jam](https://github.com/caolan/jam),
32-
[spm](https://github.com/spmjs/spm),
33-
and [npm](https://github.com/npm/npm).
34-
35-
## Install
36-
37-
### jspm
38-
```terminal
39-
jspm install github:aureooms/js-compare
40-
# or
41-
jspm install npm:@aureooms/js-compare
42-
```
43-
### duo
44-
No install step needed for duo!
45-
46-
### component
47-
```terminal
48-
component install aureooms/js-compare
49-
```
50-
51-
### bower
52-
```terminal
53-
bower install @aureooms/js-compare
54-
```
55-
56-
### ender
57-
```terminal
58-
ender add @aureooms/js-compare
59-
```
60-
61-
### jam
62-
```terminal
63-
jam install @aureooms/js-compare
64-
```
65-
66-
### spm
67-
```terminal
68-
spm install @aureooms/js-compare --save
69-
```
70-
71-
### npm
72-
```terminal
73-
npm install @aureooms/js-compare --save
74-
```
75-
76-
## Require
77-
### jspm
78-
```js
79-
let compare = require( "github:aureooms/js-compare" ) ;
80-
// or
81-
import compare from '@aureooms/js-compare' ;
82-
```
83-
### duo
84-
```js
85-
let compare = require( "aureooms/js-compare" ) ;
86-
```
87-
88-
### component, ender, spm, npm
89-
```js
90-
let compare = require( "@aureooms/js-compare" ) ;
91-
```
92-
93-
### bower
94-
The script tag exposes the global variable `compare`.
95-
```html
96-
<script src="bower_components/@aureooms/js-compare/js/dist/compare.min.js"></script>
97-
```
98-
Alternatively, you can use any tool mentioned [here](http://bower.io/docs/tools/).
99-
100-
### jam
101-
```js
102-
require( [ "@aureooms/js-compare" ] , function ( compare ) { ... } ) ;
103-
```
104-
105-
## Use
106-
107-
```js
108-
let increasing = compare.increasing ;
109-
let decreasing = compare.decreasing ;
110-
111-
increasing( 1 , 1 ) === 0 ; // true
112-
increasing( 1 , 2 ) < 0 ; // true
113-
increasing( 2 , 1 ) > 0 ; // true
114-
decreasing( 1 , 1 ) === 0 ; // true
115-
decreasing( 1 , 2 ) > 0 ; // true
116-
decreasing( 2 , 1 ) < 0 ; // true
117-
118-
let lexicographical = compare.lexicographical( increasing ) ;
119-
120-
lexicographical( [ 1 , 1 ] , [ 1 , 1 ] ) === 0 ; // true
121-
lexicographical( [ 1 , 1 ] , [ 1 , 2 ] ) < 0 ; // true
122-
lexicographical( [ 1 , 2 ] , [ 1 , 1 ] ) > 0 ; // true
123-
124-
lexicographical( [ 1 , 1 ] , [ 1 , 1 , 1 ] ) < 0 ; // true
125-
lexicographical( [ 1 , 1 , 1 ] , [ 1 , 1 ] ) > 0 ; // true
126-
lexicographical( [ 2 , 1 ] , [ 1 , 1 , 1 ] ) > 0 ; // true
127-
lexicographical( [ 1 , 1 , 1 ] , [ 2 , 1 ] ) < 0 ; // true
128-
129-
let reverselexicographical = compare.reverse( lexicographical ) ;
130-
131-
reverselexicographical( [ 1 , 1 ] , [ 1 , 1 ] ) === 0 ; // true
132-
reverselexicographical( [ 1 , 1 ] , [ 1 , 2 ] ) > 0 ; // true
133-
reverselexicographical( [ 1 , 2 ] , [ 1 , 1 ] ) < 0 ; // true
134-
135-
reverselexicographical( [ 1 , 1 ] , [ 1 , 1 , 1 ] ) > 0 ; // true
136-
reverselexicographical( [ 1 , 1 , 1 ] , [ 1 , 1 ] ) < 0 ; // true
137-
reverselexicographical( [ 2 , 1 ] , [ 1 , 1 , 1 ] ) < 0 ; // true
138-
reverselexicographical( [ 1 , 1 , 1 ] , [ 2 , 1 ] ) > 0 ; // true
139-
140-
// ... and many more variants.
141-
142-
/** compare backwards, if identical compare length */
143-
let increasing = compare.colexicographical( compare.increasing ) ;
144-
/** compare length first, if identical compare forwards */
145-
let increasing = compare.quasilexicographical( compare.increasing ) ;
146-
/** compare length first, if identical compare backwards */
147-
let increasing = compare.quasicolexicographical( compare.increasing ) ;
148-
/** compare components in range [0, 3[, forwards */
149-
let increasing = compare.fixedlexicographical( compare.increasing , 3 ) ;
150-
/** compare components in range [0, 3[, backwards */
151-
let increasing = compare.fixedcolexicographical( compare.increasing , 3 ) ;
152-
/** compare components in range [1, 4[, forwards */
153-
let increasing = compare.rangedlexicographical( compare.increasing , 1 , 4 ) ;
154-
/** compare components in range [1, 4[, backwards */
155-
let increasing = compare.rangedcolexicographical( compare.increasing , 1 , 4 ) ;
156-
157-
// Also includes comparison function creation tools. Hereunder, all versions are equivalent.
158-
let operator = require( "@aureooms/js-operator" ) ;
159-
let increasing = compare.fn( compare.increasing , operator.len ) ;
160-
let increasing = compare.attr( compare.increasing , "length" ) ;
161-
let increasing = compare.len( compare.increasing ) ;
162-
163-
// Plus an additional useful tool.
164-
compare.sign( -2378 ) === -1 ; // true
165-
compare.sign( 0 ) === 0 ; // true
166-
compare.sign( 2378 ) === 1 ; // true
167-
```
168-
16927
## References
17028

17129
- https://en.wikipedia.org/wiki/Lexicographical_order

doc/css/style.css

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,50 @@ h2,
33
.navigation,
44
.layout-container > header,
55
footer
6-
{{
6+
{
77
border: none;
8-
}}
8+
}
99

10-
.project-name {{
10+
.project-name {
1111
color: #FC913A;
1212
font-weight: bold;
13-
}}
13+
}
1414

15-
.layout-container > header > a.repo-url-github {{
15+
.layout-container > header > a.repo-url-github {
1616
font-size: inherit;
1717
display: inline;
1818
background: none;
1919
vertical-align: inherit;
20-
}}
20+
}
2121

22-
.search-box img {{
22+
.search-box img {
2323
display: none;
24-
}}
24+
}
2525

26-
.search-box::before{{
26+
.search-box::before{
2727
content: "search";
28-
}}
28+
}
2929

30-
.search-input-edge {{
30+
.search-input-edge {
3131
height: 0px;
32-
}}
32+
}
3333

34-
.search-result {{
34+
.search-result {
3535
width: 300px;
3636
margin-left: 42px;
3737
box-shadow: 1px 1px 13px rgba(0,0,0,0.2);
38-
}}
38+
}
3939

40-
.search-input {{
40+
.search-input {
4141
visibility: visible;
42-
}}
42+
}
4343

44-
.search-result li.search-separator {{
44+
.search-result li.search-separator {
4545
text-transform: capitalize;
4646
background-color: #ccc;
47-
}}
47+
}
4848

49-
span[data-ice="signature"] > span {{
49+
span[data-ice="signature"] > span {
5050
/*font-weight: bold;*/
5151
font-style: italic;
52-
}}
52+
}

doc/manual/example.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,65 @@
11
# Examples
22

3-
> More examples in [the test files](https://github.com/{repository}/tree/master/test/src).
3+
> More examples in [the test files](https://github.com/aureooms/js-compare/tree/master/test/src).
4+
5+
```js
6+
let increasing = compare.increasing ;
7+
let decreasing = compare.decreasing ;
8+
9+
increasing( 1 , 1 ) === 0 ; // true
10+
increasing( 1 , 2 ) < 0 ; // true
11+
increasing( 2 , 1 ) > 0 ; // true
12+
decreasing( 1 , 1 ) === 0 ; // true
13+
decreasing( 1 , 2 ) > 0 ; // true
14+
decreasing( 2 , 1 ) < 0 ; // true
15+
16+
let lexicographical = compare.lexicographical( increasing ) ;
17+
18+
lexicographical( [ 1 , 1 ] , [ 1 , 1 ] ) === 0 ; // true
19+
lexicographical( [ 1 , 1 ] , [ 1 , 2 ] ) < 0 ; // true
20+
lexicographical( [ 1 , 2 ] , [ 1 , 1 ] ) > 0 ; // true
21+
22+
lexicographical( [ 1 , 1 ] , [ 1 , 1 , 1 ] ) < 0 ; // true
23+
lexicographical( [ 1 , 1 , 1 ] , [ 1 , 1 ] ) > 0 ; // true
24+
lexicographical( [ 2 , 1 ] , [ 1 , 1 , 1 ] ) > 0 ; // true
25+
lexicographical( [ 1 , 1 , 1 ] , [ 2 , 1 ] ) < 0 ; // true
26+
27+
let reverselexicographical = compare.reverse( lexicographical ) ;
28+
29+
reverselexicographical( [ 1 , 1 ] , [ 1 , 1 ] ) === 0 ; // true
30+
reverselexicographical( [ 1 , 1 ] , [ 1 , 2 ] ) > 0 ; // true
31+
reverselexicographical( [ 1 , 2 ] , [ 1 , 1 ] ) < 0 ; // true
32+
33+
reverselexicographical( [ 1 , 1 ] , [ 1 , 1 , 1 ] ) > 0 ; // true
34+
reverselexicographical( [ 1 , 1 , 1 ] , [ 1 , 1 ] ) < 0 ; // true
35+
reverselexicographical( [ 2 , 1 ] , [ 1 , 1 , 1 ] ) < 0 ; // true
36+
reverselexicographical( [ 1 , 1 , 1 ] , [ 2 , 1 ] ) > 0 ; // true
37+
38+
// ... and many more variants.
39+
40+
/** compare backwards, if identical compare length */
41+
let increasing = compare.colexicographical( compare.increasing ) ;
42+
/** compare length first, if identical compare forwards */
43+
let increasing = compare.quasilexicographical( compare.increasing ) ;
44+
/** compare length first, if identical compare backwards */
45+
let increasing = compare.quasicolexicographical( compare.increasing ) ;
46+
/** compare components in range [0, 3[, forwards */
47+
let increasing = compare.fixedlexicographical( compare.increasing , 3 ) ;
48+
/** compare components in range [0, 3[, backwards */
49+
let increasing = compare.fixedcolexicographical( compare.increasing , 3 ) ;
50+
/** compare components in range [1, 4[, forwards */
51+
let increasing = compare.rangedlexicographical( compare.increasing , 1 , 4 ) ;
52+
/** compare components in range [1, 4[, backwards */
53+
let increasing = compare.rangedcolexicographical( compare.increasing , 1 , 4 ) ;
54+
55+
// Also includes comparison function creation tools. Hereunder, all versions are equivalent.
56+
let operator = require( "@aureooms/js-operator" ) ;
57+
let increasing = compare.fn( compare.increasing , operator.len ) ;
58+
let increasing = compare.attr( compare.increasing , "length" ) ;
59+
let increasing = compare.len( compare.increasing ) ;
60+
61+
// Plus an additional useful tool.
62+
compare.sign( -2378 ) === -1 ; // true
63+
compare.sign( 0 ) === 0 ; // true
64+
compare.sign( 2378 ) === 1 ; // true
65+
```

doc/manual/installation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ or [jspm](https://jspm.org/docs).
88

99
### yarn
1010
```terminal
11-
yarn add {fullname}
11+
yarn add @aureooms/js-compare
1212
```
1313

1414
### npm
1515
```terminal
16-
npm install {fullname} --save
16+
npm install @aureooms/js-compare --save
1717
```
1818

1919
### jspm
2020
```terminal
21-
jspm install npm:{fullname}
21+
jspm install npm:@aureooms/js-compare
2222
```

doc/manual/usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import '@babel/polyfill' ;
1212

1313
Then, import the library where needed
1414
```js
15-
const {var} = require( '{fullname}' ) ;
15+
const compare = require( '@aureooms/js-compare' ) ;
1616
// or
17-
import * as {var} from '{fullname}' ;
17+
import * as compare from '@aureooms/js-compare' ;
1818
```

doc/scripts/header.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
var domReady = function(callback) {{
1+
var domReady = function(callback) {
22
var state = document.readyState ;
3-
if ( state === 'interactive' || state === 'complete' ) {{
3+
if ( state === 'interactive' || state === 'complete' ) {
44
callback() ;
5-
}}
6-
else {{
5+
}
6+
else {
77
document.addEventListener('DOMContentLoaded', callback);
8-
}}
9-
}} ;
8+
}
9+
} ;
1010

1111

12-
domReady(function(){{
12+
domReady(function(){
1313

1414
var projectname = document.createElement('a');
1515
projectname.classList.add('project-name');
16-
projectname.text = '{repository}';
16+
projectname.text = 'aureooms/js-compare';
1717
projectname.href = './index.html' ;
1818

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

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

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

2929
// active search box when focus on searchBox.
30-
input.addEventListener('focus', function(){{
30+
input.addEventListener('focus', function(){
3131
searchBox.classList.add('active');
32-
}});
32+
});
3333

34-
}});
34+
});

0 commit comments

Comments
 (0)