Add isBeforeDate, isAfterDate, isSameDate

This commit is contained in:
Angelos Chalaris
2018-09-29 13:58:38 +03:00
parent bd04a9e9ac
commit 08509a2aed
15 changed files with 55 additions and 17 deletions

View File

@ -15,7 +15,7 @@ const luhnCheck = num => {
.reverse()
.map(x => parseInt(x));
let lastDigit = arr.splice(0, 1)[0];
let sum = arr.reduce((acc, val, i) => (i % 2 !== 0 ? acc + val : acc + ((val * 2) % 9) || 9), 0);
let sum = arr.reduce((acc, val, i) => (i % 2 !== 0 ? acc + val : acc + (val * 2) % 9 || 9), 0);
sum += lastDigit;
return sum % 10 === 0;
};