Skip to content

Commit 5a83bff

Browse files
💥 refactor!: Remove isSorted and firstInversion.
Moved to @comparison-sorting/is-sorted. BREAKING CHANGE: Those functions are gone from the exports.
1 parent 2158ea6 commit 5a83bff

File tree

10 files changed

+126
-130
lines changed

10 files changed

+126
-130
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Parent is [@aureooms/js-algorithms](https://github.com/make-github-pseudonymous-
1616
> working. Documentation may be present. Coherence may be. Maybe.
1717
1818
```js
19-
import {isSorted} from '@aureooms/js-sort';
20-
import {increasing, decreasing} from '@aureooms/js-compare';
19+
import {isSorted} from '@comparison-sorting/is-sorted';
20+
import {increasing, decreasing} from '@total-order/primitive';
2121
isSorted(increasing, [1, 2, 3], 0, 3); // true
2222
isSorted(decreasing, [1, 2, 3], 0, 3); // false
2323
```

doc/manual/example.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Examples
22
```js
3-
import * as sort from "@aureooms/js-sort" ;
4-
import {increasing, decreasing} from "@aureooms/js-compare" ;
3+
import {selectionsort} from '@aureooms/js-sort' ;
4+
import {increasing, decreasing} from '@total-order/primitive';
5+
import {isSorted} from '@comparison-sorting/is-sorted';
56

67
let a = [ 1 , 6 , 5 , 3 , 2 , 4 ] ;
7-
let {selectionsort, isSorted} = sort;
88

99
selectionsort( increasing , a , 0 , a.length ) ;
1010

@@ -19,5 +19,5 @@ isSorted(decreasing, a, 0, a.length); // true
1919
// but also
2020

2121
/** bubblesort */
22-
let {bubblesort} = sort ;
22+
import {bubblesort} from '@aureooms/js-sort' ;
2323
```

package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,20 @@
7777
},
7878
"dependencies": {},
7979
"devDependencies": {
80-
"@aureooms/js-array": "4.0.0",
81-
"@aureooms/js-compare": "1.4.8",
8280
"@aureooms/js-functools": "2.0.3",
8381
"@aureooms/js-in-situ-sort-spec": "8.0.0",
84-
"@aureooms/js-itertools": "5.0.1",
85-
"@aureooms/js-random": "2.0.0",
8682
"@babel/cli": "7.13.10",
8783
"@babel/core": "7.13.10",
8884
"@babel/preset-env": "7.13.10",
8985
"@babel/register": "7.13.8",
86+
"@comparison-sorting/is-sorted": "^0.0.1",
87+
"@iterable-iterator/chain": "^2.0.1",
88+
"@iterable-iterator/consume": "^1.0.1",
89+
"@iterable-iterator/list": "^1.0.1",
90+
"@iterable-iterator/range": "^2.0.1",
91+
"@randomized/random": "^4.0.0",
92+
"@set-theory/cartesian-product": "^2.0.1",
93+
"@total-order/primitive": "^1.0.1",
9094
"ava": "3.15.0",
9195
"babel-plugin-transform-remove-console": "6.9.4",
9296
"babel-plugin-unassert": "3.0.1",

src/utils/firstInversion.js

-23
This file was deleted.

src/utils/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export * from './firstInversion' ;
2-
export * from './isSorted' ;
31
export * from './whole' ;

src/utils/isSorted.js

-8
This file was deleted.

test/src/firstInversion.js

-26
This file was deleted.

test/src/isSorted.js

-26
This file was deleted.

test/src/whole.js

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import test from 'ava' ;
22

3-
import { iota , swap } from "@aureooms/js-array" ;
4-
import { shuffle } from "@aureooms/js-random" ;
5-
import * as compare from "@aureooms/js-compare" ;
6-
import * as itertools from "@aureooms/js-itertools" ;
3+
import { shuffle } from "@randomized/random" ;
4+
import {increasing, decreasing} from "@total-order/primitive" ;
5+
import {exhaust} from '@iterable-iterator/consume';
6+
import {map} from '@iterable-iterator/map';
7+
import {range} from '@iterable-iterator/range';
8+
import {list} from '@iterable-iterator/list';
9+
import {_chain as chain} from '@iterable-iterator/chain';
10+
import {product} from '@set-theory/cartesian-product';
711
import functools from "@aureooms/js-functools" ;
12+
import {isSorted} from '@comparison-sorting/is-sorted';
813

914
import * as sort from '../../src' ;
1015

@@ -17,20 +22,19 @@ function check ( sortname, arraysort, ctor, n, comparename, compare ) {
1722
test( title, t => {
1823

1924
// SETUP ARRAY
20-
const a = new ctor(n);
21-
iota( a, 0, n, 0 );
25+
const a = ctor.from(range(n));
2226

2327
// SORT ARRAY
2428
shuffle( a, 0, n );
2529
arraysort( compare, a );
2630

27-
t.true( sort.isSorted( compare , a , 0 , n ) , "check sorted" );
31+
t.true( isSorted( compare , a , 0 , n ) , "check sorted" );
2832
t.is( n, a.length, "check length a" );
2933

3034
} );
3135
}
3236

33-
itertools.exhaust( itertools.map(
37+
exhaust( map(
3438

3539
function ( args ) {
3640

@@ -42,20 +46,20 @@ function ( args ) {
4246

4347
check( sortname, arraysort, type, size, comparename, compare );
4448

45-
}, itertools.list( itertools.chain( args ) ) );
49+
}, list( chain( args ) ) );
4650

4751
} ,
4852

49-
itertools.product( [
53+
product( [
5054

5155
[
5256
[ "selectionsort", sort.selectionsort ],
5357
[ "bubblesort", sort.bubblesort ]
5458
],
5559

5660
[
57-
[ "increasing", compare.increasing ],
58-
[ "decreasing", compare.decreasing ]
61+
[ "increasing", increasing ],
62+
[ "decreasing", decreasing ]
5963
],
6064

6165
[[0], [1], [2], [10], [63], [64], [65]],

0 commit comments

Comments
 (0)