diff --git a/source/Ox/js/Format.js b/source/Ox/js/Format.js index b88a0b53..d151dc1a 100644 --- a/source/Ox/js/Format.js +++ b/source/Ox/js/Format.js @@ -653,13 +653,13 @@ Ox.formatISBN = function(isbn, length) { var ret = ''; function getCheckDigit(isbn) { var mod = isbn.length == 10 ? 11 : 10 - return (mod - Ox.sum( + return (Ox.mod(mod - Ox.sum( isbn.slice(0, -1).split('').map(function(digit, index) { return isbn.length == 10 ? parseInt(digit) * (10 - index) : parseInt(digit) * (index % 2 == 0 ? 1 : 3); }) - ) % mod + '').replace('10', 'X'); + ), mod) + '').replace('10', 'X'); } isbn = isbn.toUpperCase().replace(/[^\dX]/g, ''); if (isbn.length == 10) {