From de0ba98607608426c52d62baf9c74fd5633a883c Mon Sep 17 00:00:00 2001 From: Johan Lindell Date: Tue, 31 Mar 2015 10:58:03 +0200 Subject: [PATCH] Fixed broken ITF-14 checksum --- ITF14.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ITF14.js b/ITF14.js index e2c84b04..09a3580e 100755 --- a/ITF14.js +++ b/ITF14.js @@ -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){