Sha256: 0a42e51065292b3801c2acd3b8a785db00fdf7ab1bfd806de854499543068908
Contents?: true
Size: 292 Bytes
Versions: 107
Compression:
Stored size: 292 Bytes
Contents
return { valid = function(isbn) isbn = isbn:gsub('-', '') if not isbn:match('^%d%d%d%d%d%d%d%d%d[%dX]$') then return false end local sum = 0 for i = 1, 10 do sum = sum + (11 - i) * (tonumber(isbn:sub(i, i)) or 10) end return sum % 11 == 0 end }
Version data entries
107 entries across 107 versions & 1 rubygems