code: function checksum(number) {
  	var res = number.substr(0, 7).split('').map(function (n) {
  		return +n;
  	}).reduce(function (sum, a, idx) {
  		return idx % 2 ? sum + a : sum + a * 3;
  	}, 0);
  
  	return (10 - res % 10) % 10;
  }
docs: Encoding documentation: Calculate the checksum digit