fix gcd and add test for fromCamelCase

This commit is contained in:
Stefan Feješ
2018-01-10 16:55:01 +01:00
parent 338c661e64
commit 5f986ea916
3 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
module.exports = (...arr) => {
const _gcd = (x, y) => (!y ? x : gcd(y, x % y));
const _gcd = (x, y) => (!y ? x : _gcd(y, x % y));
return [...arr].reduce((a, b) => _gcd(a, b));
};