style fix

This commit is contained in:
Honeybar 2018-07-15 00:35:44 -07:00 committed by GitHub
parent 126bfbff6b
commit 45fde8b348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 14 deletions

View File

@ -145,7 +145,6 @@ function factory (type, config, load, typed) {
* @returns {BigNumber} Returns the factorial of n
*/
function bigFactorial (n) {
if (n.isZero()) {
return new type.BigNumber(1) // 0! is per definition 1

View File

@ -32,9 +32,7 @@ function factory (type, config, load, typed) {
*/
const permutations = typed('permutations', {
'number | BigNumber': factorial,
'number, number': function (n, k) {
if (!isInteger(n) || n < 0) {
throw new TypeError('Positive integer value expected in function permutations')
}
@ -44,7 +42,6 @@ function factory (type, config, load, typed) {
if (k > n) {
throw new TypeError('second argument k must be less than or equal to first argument n')
}
// Permute n objects, k at a time
return product((n - k) + 1, n)
},

View File

@ -1,14 +1,14 @@
function product (i, n) {
let half
if (n < i) {
return 1
}
if (n === i) {
return n
}
half = ((n + i) / 2 ) | 0
return product(i, half) * product(half + 1, n)
let half
if (n < i) {
return 1
}
if (n === i) {
return n
}
half = ((n + i) / 2) | 0
return product(i, half) * product(half + 1, n)
}
module.exports = product
module.exports = product