We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54cd119 commit aa21008Copy full SHA for aa21008
README.md
@@ -8,17 +8,17 @@ See [docs](https://aureooms.github.io/js-poset).
8
Parent is [@aureooms/js-algorithms](https://github.com/aureooms/js-algorithms).
9
10
```js
11
-import {clarkson} from '@aureooms/js-poset';
+import {minima} from '@aureooms/js-poset';
12
import {increasing} from '@aureooms/js-compare';
13
14
const a = [4, 12, 2, 6, 3];
15
16
const divides = (a, b) => b % a === 0;
17
-const n = clarkson(divides, a, 0, a.length); // 2
+const n = minima(divides, a, 0, a.length); // 2
18
a.slice(0, n).sort(increasing); // 2 3
19
20
const norel = (_a, _b) => false;
21
-clarkson(norel, a, 0, a.length); // a.length
+minima(norel, a, 0, a.length); // a.length
22
```
23
24
[](https://raw.githubusercontent.com/aureooms/js-poset/master/LICENSE)
src/index.js
@@ -1 +1,8 @@
1
-export * from './minima';
+import minima from './minima';
2
+
3
+/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
4
+export default {
5
+ minima
6
+};
7
+export {minima};
src/minima/clarkson.js
@@ -22,7 +22,7 @@
* -------------------- Kenneth L. Clarkson -
*/
25
-export function clarkson(prec, a, i, j) {
+export default function clarkson(prec, a, i, j) {
26
//
27
// This algorithm reorganizes the input array `a` as follows
28
// - elements that are minima are put at the front of `a`
src/minima/index.js
@@ -1 +1,5 @@
-export * from './clarkson';
+import clarkson from './clarkson';
+export default clarkson;
+export {clarkson};
test/src/minima.js
@@ -1,6 +1,6 @@
import test from 'ava';
-import {clarkson} from '../../src';
+import {minima} from '../../src';
import {sort} from '@aureooms/js-insertion-sort';
import {alloc, iota} from '@aureooms/js-array';
@@ -15,7 +15,7 @@ test('minima 1', (t) => {
shuffle(a, 0, a.length);
- const min = clarkson(divides, a, 0, a.length);
+ const min = minima(divides, a, 0, a.length);
t.is(min, 1, 'minima set has cardinality 1');
@@ -31,7 +31,7 @@ test('minima 2,3', (t) => {
31
32
shuffle(a, i, j);
33
34
- const min = clarkson(divides, a, i, j);
+ const min = minima(divides, a, i, j);
35
36
t.is(min - i, 2, 'minima set has cardinality 2');
37
@@ -50,7 +50,7 @@ test('minima totally unordered set', (t) => {
50
51
shuffle(a, 0, n);
52
53
- const min = clarkson(norel, a, 0, n);
+ const min = minima(norel, a, 0, n);
54
55
t.deepEqual(min, n, 'minima set has cardinality n');
56
});
0 commit comments