Skip to content

Commit

Permalink
Fixed broken ITF-14 checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
lindell committed Mar 31, 2015
1 parent dc64e7f commit de0ba98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ITF14.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ function ITF14(ITF14number){
function checksum(numberString){
var result = 0;

for(var i=0;i<13;i++){result+=parseInt(numberString[i])}
for(var i=0;i<13;i++){result+=parseInt(numberString[i])*(3-(i%2)*2)}

return result % 10;
return 10 - (result % 10);
}

function valid(number){
Expand Down

0 comments on commit de0ba98

Please sign in to comment.