js-combinatorics
Advanced tools
Comparing version 1.5.6 to 1.5.7
@@ -14,3 +14,3 @@ /** | ||
*/ | ||
export declare const version = "1.5.6"; | ||
export declare const version = "1.5.7"; | ||
/** | ||
@@ -17,0 +17,0 @@ * BigInt Workaround |
@@ -14,4 +14,4 @@ /** | ||
*/ | ||
export const version = '1.5.6'; | ||
const _BI = typeof BigInt == 'function' ? BigInt : Number; | ||
export const version = '1.5.7'; | ||
const _BI = typeof BigInt === 'function' ? BigInt : Number; | ||
/** | ||
@@ -284,4 +284,6 @@ * crops BigInt | ||
// console.log('overriding _CBase'); | ||
const ctor = this.length.constructor; | ||
const [zero, one, two] = [ctor(0), ctor(1), ctor(2)]; | ||
if (typeof BigInt !== 'function') { | ||
throw new RangeError(`needs BigInt`); | ||
} | ||
const [zero, one, two] = [_BI(0), _BI(1), _BI(2)]; | ||
const inc = (x) => { | ||
@@ -292,5 +294,5 @@ const u = x & -x; | ||
}; | ||
let x = (one << ctor(this.size)) - one; // 0b11...1 | ||
let x = (one << _BI(this.size)) - one; // 0b11...1 | ||
return function* (it, len) { | ||
for (let i = 0; i < len; i++, x = inc(x)) { | ||
for (let i = zero; i < _BI(len); i++, x = inc(x)) { | ||
let result = []; | ||
@@ -297,0 +299,0 @@ for (let y = x, j = 0; zero < y; y >>= one, j++) { |
@@ -17,4 +17,4 @@ "use strict"; | ||
*/ | ||
exports.version = '1.5.6'; | ||
const _BI = typeof BigInt == 'function' ? BigInt : Number; | ||
exports.version = '1.5.7'; | ||
const _BI = typeof BigInt === 'function' ? BigInt : Number; | ||
/** | ||
@@ -294,4 +294,6 @@ * crops BigInt | ||
// console.log('overriding _CBase'); | ||
const ctor = this.length.constructor; | ||
const [zero, one, two] = [ctor(0), ctor(1), ctor(2)]; | ||
if (typeof BigInt !== 'function') { | ||
throw new RangeError(`needs BigInt`); | ||
} | ||
const [zero, one, two] = [_BI(0), _BI(1), _BI(2)]; | ||
const inc = (x) => { | ||
@@ -302,5 +304,5 @@ const u = x & -x; | ||
}; | ||
let x = (one << ctor(this.size)) - one; // 0b11...1 | ||
let x = (one << _BI(this.size)) - one; // 0b11...1 | ||
return function* (it, len) { | ||
for (let i = 0; i < len; i++, x = inc(x)) { | ||
for (let i = zero; i < _BI(len); i++, x = inc(x)) { | ||
let result = []; | ||
@@ -307,0 +309,0 @@ for (let y = x, j = 0; zero < y; y >>= one, j++) { |
{ | ||
"name": "js-combinatorics", | ||
"version": "1.5.6", | ||
"version": "1.5.7", | ||
"description": "Simple combinatorics like power set, combination, and permutation in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "combinatorics.js", |
@@ -43,3 +43,3 @@ [![ES2015](https://img.shields.io/badge/JavaScript-ES2015-blue.svg)](http://www.ecma-international.org/ecma-262/6.0/) | ||
```javascript | ||
import * as $C from 'https://cdn.jsdelivr.net/npm/js-combinatorics@1.5.6/combinatorics.min.js'; | ||
import * as $C from 'https://cdn.jsdelivr.net/npm/js-combinatorics@1.5.7/combinatorics.min.js'; | ||
``` | ||
@@ -79,3 +79,3 @@ | ||
permutation: [Function: permutation], | ||
version: '1.5.6' | ||
version: '1.5.7' | ||
} | ||
@@ -82,0 +82,0 @@ > [...new $C.Permutation('abcd')] |
@@ -26,4 +26,4 @@ (function (factory) { | ||
*/ | ||
exports.version = '1.5.6'; | ||
const _BI = typeof BigInt == 'function' ? BigInt : Number; | ||
exports.version = '1.5.7'; | ||
const _BI = typeof BigInt === 'function' ? BigInt : Number; | ||
/** | ||
@@ -303,4 +303,6 @@ * crops BigInt | ||
// console.log('overriding _CBase'); | ||
const ctor = this.length.constructor; | ||
const [zero, one, two] = [ctor(0), ctor(1), ctor(2)]; | ||
if (typeof BigInt !== 'function') { | ||
throw new RangeError(`needs BigInt`); | ||
} | ||
const [zero, one, two] = [_BI(0), _BI(1), _BI(2)]; | ||
const inc = (x) => { | ||
@@ -311,5 +313,5 @@ const u = x & -x; | ||
}; | ||
let x = (one << ctor(this.size)) - one; // 0b11...1 | ||
let x = (one << _BI(this.size)) - one; // 0b11...1 | ||
return function* (it, len) { | ||
for (let i = 0; i < len; i++, x = inc(x)) { | ||
for (let i = zero; i < _BI(len); i++, x = inc(x)) { | ||
let result = []; | ||
@@ -316,0 +318,0 @@ for (let y = x, j = 0; zero < y; y >>= one, j++) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60619
1408