def of number
      raise_on_type_mismatch number
      digits = convert_number_to_digits(number)

      sum    = digits.reverse.map.with_index do |digit, idx|
        idx.even? ? (digit * 2).divmod(10).reduce(&:+) : digit
      end.reduce(&:+)

      (10 - sum % 10) % 10
    end
def of number
      raise_on_type_mismatch number
      digits = convert_number_to_digits(number)

      sum    = digits.reverse.map.with_index do |digit, idx|
        idx.even? ? (digit * 2).divmod(10).reduce(&:+) : digit
      end.reduce(&:+)

      (10 - sum % 10) % 10
    end
Calculates Luhn checksum

 @example
   Sjekksum::Luhn.of(7992739871) #=> 3

 @param  number [Integer, String] number for which the checksum should be calculated

 @return [Integer] calculated checksum