Skip to content

Commit 9a98b33

Browse files
committed
Merge branch 'main' of github.com:dankogai/js-combinatorics
2 parents c2a56d6 + be5fcc7 commit 9a98b33

9 files changed

Lines changed: 30 additions & 18 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
name: CI via GitHub Actions
55

66
on:
7+
workflow_dispatch:
78
push:
89
branches: [ main ]
910
pull_request:
@@ -14,9 +15,9 @@ jobs:
1415
runs-on: ubuntu-latest
1516
strategy:
1617
matrix:
17-
node-version: [18, 16]
18+
node-version: [22, 20, 18]
1819
steps:
19-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2021
- uses: actions/setup-node@v3
2122
with:
2223
node-version: ${{ matrix.node-version }}

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ UMD=$(UMD_DIR)/$(JS)
1111
all: $(PJ) $(JS) $(COMMONJS) $(UMD)
1212

1313
$(JS): $(PJ) $(TS)
14-
tsc -d --target es2020 $(TS)
14+
tsc -d --module nodenext $(TS)
1515

1616
$(COMMONJS): $(PJ) $(TS)
1717
tsc --module commonjs --outDir $(COMMONJS_DIR) --target es2020 $(TS)
1818

1919
$(UMD): $(PJ) $(TS)
20-
tsc --module umd --outDir $(UMD_DIR) --target es2020 $(TS)
20+
-tsc --module umd --outDir $(UMD_DIR) --target es2020 $(TS) > /dev/null
2121

2222
test: all
2323
mocha

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { Combination, Permutation } from './combinatorics.js';
4747
You don't even have to install if you `import` from CDNs.
4848

4949
```javascript
50-
import * as $C from 'https://cdn.jsdelivr.net/npm/js-combinatorics@2.1.1/combinatorics.min.js';
50+
import * as $C from 'https://cdn.jsdelivr.net/npm/js-combinatorics@2.1.2/combinatorics.min.js';
5151
```
5252

5353
Since this is an ES6 module, `type="module"` is required the `<script>` tags. of your HTML files. But you can make it globally available as follows.
@@ -84,7 +84,7 @@ undefined
8484
factorial: [Function: factorial],
8585
permutation: [Function: permutation],
8686
randomInteger: [Function: randomInteger],
87-
version: '2.1.1'
87+
version: '2.1.2'
8888
}
8989
> [...new $C.Permutation('abcd')]
9090
[

combinatorics.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @link: http://en.wikipedia.org/wiki/Factorial_number_system
1313
* @link: https://en.wikipedia.org/wiki/Combinatorial_number_system
1414
*/
15-
export declare const version = "2.1.1";
15+
export declare const version = "2.1.2";
1616
/**
1717
* BigInt Workaround
1818
*

combinatorics.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @link: http://en.wikipedia.org/wiki/Factorial_number_system
1313
* @link: https://en.wikipedia.org/wiki/Combinatorial_number_system
1414
*/
15-
export const version = '2.1.1';
15+
export const version = '2.1.2';
1616
/**
1717
* calculates `P(n, k)`.
1818
*
@@ -218,6 +218,18 @@ class _CBase {
218218
* an alias of `at`
219219
*/
220220
nth(n) { return this.at(n); }
221+
/**
222+
* the seed iterable
223+
*/
224+
seed;
225+
/**
226+
* the size (# of elements) of each element.
227+
*/
228+
size;
229+
/**
230+
* the number of elements
231+
*/
232+
length;
221233
/**
222234
* pick random element
223235
*/
@@ -264,6 +276,7 @@ export class Permutation extends _CBase {
264276
* Combination
265277
*/
266278
export class Combination extends _CBase {
279+
comb;
267280
constructor(seed, size = 0) {
268281
super();
269282
this.seed = [...seed];
@@ -317,6 +330,7 @@ export class Combination extends _CBase {
317330
* Base N
318331
*/
319332
export class BaseN extends _CBase {
333+
base;
320334
constructor(seed, size = 1) {
321335
if (size < 1)
322336
throw new RangeError(`${size} is out of range`);

combinatorics.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import { doesNotThrow } from "assert";
2-
import { type } from "os";
3-
41
/**
52
* combinatorics.js
63
*
@@ -15,7 +12,7 @@ import { type } from "os";
1512
* @link: http://en.wikipedia.org/wiki/Factorial_number_system
1613
* @link: https://en.wikipedia.org/wiki/Combinatorial_number_system
1714
*/
18-
export const version = '2.1.1';
15+
export const version = '2.1.2';
1916
/**
2017
* BigInt Workaround
2118
*

commonjs/combinatorics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exports.CartesianProduct = exports.PowerSet = exports.BaseN = exports.Combinatio
1515
* @link: http://en.wikipedia.org/wiki/Factorial_number_system
1616
* @link: https://en.wikipedia.org/wiki/Combinatorial_number_system
1717
*/
18-
exports.version = '2.1.1';
18+
exports.version = '2.1.2';
1919
/**
2020
* calculates `P(n, k)`.
2121
*

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-combinatorics",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"description": "Simple combinatorics like power set, combination, and permutation in JavaScript",
55
"main": "combinatorics.js",
66
"module": "combinatorics.js",
@@ -18,9 +18,9 @@
1818
],
1919
"runkitExample": "require=require(\"esm\")(module);\nvar Combinatorics=require(\"js-combinatorics\");\n",
2020
"devDependencies": {
21-
"typescript": "^3.9.7",
22-
"@types/node": "^14.0.26",
23-
"mocha": "^8.0.0",
21+
"typescript": "^5.0.0",
22+
"@types/node": "^20.9.0",
23+
"mocha": "^10.0.0",
2424
"chai": "^4.2.0"
2525
},
2626
"scripts": {

umd/combinatorics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @link: http://en.wikipedia.org/wiki/Factorial_number_system
2525
* @link: https://en.wikipedia.org/wiki/Combinatorial_number_system
2626
*/
27-
exports.version = '2.1.1';
27+
exports.version = '2.1.2';
2828
/**
2929
* calculates `P(n, k)`.
3030
*

0 commit comments

Comments
 (0)