ru-codes
Version:
Проверка и генерация ИНН, КПП и т. п.
19 lines (10 loc) • 332 B
JavaScript
const Check = require ('./Check')
module.exports = class extends Check {
constructor (coefficients, checkSumLength = 1) {
super (coefficients.length + checkSumLength, checkSumLength)
this.coefficients = coefficients
}
processDigit (pos, digit) {
this.sum += digit * this.coefficients [pos]
}
}