Comparing version 0.0.8 to 0.0.10
@@ -18,4 +18,4 @@ "use strict"; | ||
format(input) { | ||
const value = this.compact(input); | ||
return util_1.strings.formatPattern('?-??????-?', value); | ||
const [value] = clean(input); | ||
return util_1.strings.splitAt(value, 1, 7).join('-'); | ||
}, | ||
@@ -55,2 +55,2 @@ validate(value) { | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FkL25ydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFlQSw0Q0FBNEM7QUFDNUMsa0NBQWtDO0FBR2xDLFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsT0FBTyxjQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxLQUFLLENBQUMsQ0FBQztBQUM1QyxDQUFDO0FBRUQsTUFBTSxJQUFJLEdBQWM7SUFDdEIsT0FBTyxDQUFDLEtBQWE7UUFDbkIsTUFBTSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFbEMsSUFBSSxHQUFHLEVBQUU7WUFDUCxNQUFNLEdBQUcsQ0FBQztTQUNYO1FBRUQsT0FBTyxLQUFLLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztJQUNuQyxDQUFDO0lBRUQsTUFBTSxDQUFDLEtBQWE7UUFDbEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUVsQyxPQUFPLGNBQU8sQ0FBQyxhQUFhLENBQUMsWUFBWSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ3BELENBQUM7SUFPRCxRQUFRLENBQUMsS0FBYTtRQUNwQixNQUFNLENBQUMsQ0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VBQVUsQ0FBQyxnQkFBZ0IsRUFBRSxFQUFFLENBQUM7U0FDckU7UUFDRCxJQUFJLElBQUksQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksR0FBRyxHQUFHLFFBQVEsSUFBSSxHQUFHLEdBQUcsUUFBUSxFQUFFO1lBQzNELE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxnQkFBZ0IsRUFBRSxFQUFFLENBQUM7U0FDckU7UUFFRCxPQUFPO1lBQ0wsT0FBTyxFQUFFLElBQUk7WUFDYixPQUFPLEVBQUUsQ0FBQztZQUNWLFlBQVksRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUNqQyxTQUFTLEVBQUUsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztTQUNoQyxDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFYSxnQkFBUSxHQUFzQixJQUFJLFdBQXhCLGNBQU0sR0FBYyxJQUFJLFNBQWhCLGVBQU8sR0FBSyxJQUFJLFNBQUMifQ== |
@@ -34,11 +34,17 @@ "use strict"; | ||
const [front, c1, back, c2] = util_1.strings.splitAt(value, 7, 8, 21); | ||
const s1 = String(10 - util_1.weightedChecksum(util_1.strings.reverse(front), [3, 1, 7, 9, 3, 1, 7], 10)); | ||
const s1 = String(10 - | ||
util_1.weightedSum(front, { | ||
reverse: true, | ||
weights: [3, 1, 7, 9, 3, 1, 7], | ||
modulus: 10, | ||
})); | ||
const s2 = String(10 - | ||
util_1.weightedChecksum(util_1.strings.reverse(back), [3, 1, 7, 9, 3, 1, 7, 9, 3, 1, 7, 9, 3, 1], 10)); | ||
if (s1 !== c1) { | ||
util_1.weightedSum(back, { | ||
reverse: true, | ||
weights: [3, 1, 7, 9, 3, 1, 7, 9, 3, 1, 7, 9, 3, 1], | ||
modulus: 10, | ||
})); | ||
if (s1 !== c1 || s2 !== c2) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
} | ||
if (s2 !== c2) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
} | ||
return { | ||
@@ -53,2 +59,2 @@ isValid: true, | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2J1LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FyL2NidS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFlQSw0Q0FBNEM7QUFDNUMsa0NBQW9EO0FBR3BELFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsT0FBTyxjQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztBQUMzQyxDQUFDO0FBRUQsTUFBTSxJQUFJLEdBQWM7SUFDdEIsT0FBTyxDQUFDLEtBQWE7UUFDbkIsTUFBTSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFbEMsSUFBSSxHQUFHLEVBQUU7WUFDUCxNQUFNLEdBQUcsQ0FBQztTQUNYO1FBRUQsT0FBTyxLQUFLLENBQUM7SUFDZixDQUFDO0lBRUQsTUFBTSxDQUFDLEtBQWE7UUFDbEIsTUFBTSxDQUFDLEtBQUssQ0FBQyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUM3QixNQUFNLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxHQUFHLGNBQU8sQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLENBQUMsQ0FBQyxDQUFDO1FBRXpDLE9BQU8sR0FBRyxDQUFD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RUFBRSxDQUFDLENBQUM7Z0JBQ25ELE9BQU8sRUFBRSxFQUFFO2FBQ1osQ0FBQyxDQUNMLENBQUM7UUFFRixJQUFJLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRSxLQUFLLEVBQUUsRUFBRTtZQUMxQixPQUFPLEVBQUUsT0FBTyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsSUFBSSxVQUFVLENBQUMsZUFBZSxFQUFFLEVBQUUsQ0FBQztTQUNwRTtRQUVELE9BQU87WUFDTCxPQUFPLEVBQUUsSUFBSTtZQUNiLE9BQU8sRUFBRSxLQUFLO1lBQ2QsWUFBWSxFQUFFLEtBQUs7WUFDbkIsU0FBUyxFQUFFLEtBQUs7U0FDakIsQ0FBQztJQUNKLENBQUM7Q0FDRixDQUFDO0FBRWEsZ0JBQVEsR0FBc0IsSUFBSSxXQUF4QixjQUFNLEdBQWMsSUFBSSxTQUFoQixlQUFPLEdBQUssSUFBSSxTQUFDIn0= |
@@ -48,3 +48,6 @@ "use strict"; | ||
} | ||
const cs = util_1.weightedChecksum(front + body, [5, 4, 3, 2, 7, 6, 5, 4, 3, 2], 11); | ||
const cs = util_1.weightedSum(front + body, { | ||
weights: [5, 4, 3, 2, 7, 6, 5, 4, 3, 2], | ||
modulus: 11, | ||
}); | ||
const digit = '012345678990'[11 - cs]; | ||
@@ -63,2 +66,2 @@ if (digit !== check) { | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hci9jdWl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWFBLDRDQUE0QztBQUM1QyxrQ0FBb0Q7QUFHcEQsTUFBTSxTQUFTLEdBQUc7SUFFaEIsSUFBSTtJQUNKLElBQUk7SUFDSixJQUF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 1, 6], 11); | ||
const sum = util_1.weightedSum(`${front}${dob}`, { | ||
weights: [3, 7, 9, 5, 8, 4, 2, 1, 6], | ||
modulus: 11, | ||
}); | ||
const digit = String(sum % 11); | ||
@@ -51,2 +54,2 @@ if (check !== digit) { | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidm5yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2F0L3Zuci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFlQSw0Q0FBNEM7QUFDNUMsa0NBQThFO0FBRzlFLFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsT0FBTyxjQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztBQUMzQyxDQUFDO0FBRUQsTUFBTSxJQUFJLEdBQWM7SUFDdEIsT0FBTyxDQUFDLEtBQWE7UUFDbkIsTUFBTSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFbEMsSUFBSSxHQUFHLEVBQUU7WUFDUCxNQUFNLEdBQUcsQ0FBQztTQUNYO1FBRUQsT0FBTyxLQUFLLENBQUM7SUFDZixDQUFDO0lBRUQsTUFBTSxDQUFDLEtBQWE7UUFDbEIsTUFBTSxDQUFDLEtBQUssQ0FBQyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUU3QixPQUFPLGNBQU8sQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUM3QyxDQUFDO0lBRUQsUUFBUSxDQUFDLEtBQWE7UUFDcEIsTUFBTSxDQUFDLEtBQUssRUFBRSxLQUFLLENBQUMsR0FBR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sZ0JBQVEsR0FBc0IsSUFBSSxXQUF4QixjQUFNLEdBQWMsSUFBSSxTQUFoQixlQUFPLEdBQUssSUFBSSxTQUFDIn0= |
@@ -41,3 +41,7 @@ "use strict"; | ||
} | ||
const sum = util_1.weightedChecksum(util_1.strings.reverse(front), [9, 8, 7, 6, 5, 4, 9, 8, 7], 11); | ||
const sum = util_1.weightedSum(front, { | ||
reverse: true, | ||
weights: [9, 8, 7, 6, 5, 4, 9, 8, 7], | ||
modulus: 11, | ||
}); | ||
const digit = '0123456789K'[sum]; | ||
@@ -56,2 +60,2 @@ if (check !== digit) { | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnV0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsL3J1dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFXQSw0Q0FBNEM7QUFDNUMsa0NBQW9EO0FBR3BELFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsTUFBTSxDQUFDLENBQUMsRUFBRSxHQUFHLENBQUMsR0FBRyxjQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztJQUVuRCxJQUFJLEdBQUcsRUFBRTtRQUNQLE9BQU8sQ0FBQyxFQUFFLEVBQUUsR0FBRyxDQUFDLENBQUM7S0FDbEI7SUFFRCxJQUFJLENBQUMsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLEVBQUU7UUFDdEIsT0FBTyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsSUFBSSxDQUFDLENBQUM7S0FDNUI7SUFFRCxPQUFPLENBQUMsQ0FBQyxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQ25CLENBQUM7QUFFRCxNQUFNLElBQUksR0FBYztJQU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0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7WUFDcEMsT0FBTyxFQUFFLEVBQUU7U0FDWixDQUFDLENBQUM7UUFFSCxNQUFNLEtBQUssR0FBRyxhQUFhLENBQUMsR0FBRyxDQUFDLENBQUM7UUFFakMsSUFBSSxLQUFLLEtBQUssS0FBSyxFQUFFO1lBQ25CLE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxlQUFlLEVBQUUsRUFBRSxDQUFDO1NBQ3BFO1FBRUQsT0FBTztZQUNMLE9BQU8sRUFBRSxJQUFJO1lBQ2IsT0FBTyxFQUFFLEtBQUs7WUFDZCxZQUFZLEVBQUUsS0FBSztZQUNuQixTQUFTLEVBQUUsS0FBSztTQUNqQixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFYSxnQkFBUSxHQUFzQixJQUFJLFdBQXhCLGNBQU0sR0FBYyxJQUFJLFNBQWhCLGVBQU8sR0FBSyxJQUFJLFNBQUMifQ== |
@@ -33,5 +33,9 @@ "use strict"; | ||
} | ||
const sum = util_1.weightedChecksum(value, [71, 67, 59, 53, 47, 43, 41, 37, 29, 23, 19, 17, 13, 7, 3].slice(16 - value.length)) % 11; | ||
const digit = '01987654321'.split('')[sum]; | ||
if (value[value.length - 1] !== digit) { | ||
const [front, check] = util_1.strings.splitAt(value, -1); | ||
const sum = util_1.weightedSum(front, { | ||
weights: [71, 67, 59, 53, 47, 43, 41, 37, 29, 23, 19, 17, 13, 7, 3].slice(16 - front.length), | ||
modulus: 11, | ||
}); | ||
const digit = '01987654321'[sum]; | ||
if (check !== digit) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
@@ -48,2 +52,2 @@ } | ||
exports.validate = impl.validate, exports.format = impl.format, exports.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us: 11, | ||
}) !== 0) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
@@ -58,3 +61,6 @@ } | ||
} | ||
if (util_1.weightedChecksum(front, [4, 3, 2, 7, 6, 5, 4, 3, 2, 1], 11) !== 0) { | ||
if (util_1.weightedSum(front, { | ||
weights: [4, 3, 2, 7, 6, 5, 4, 3, 2, 1], | ||
modulus: 11, | ||
}) !== 0) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
@@ -75,2 +81,2 @@ } | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2VjL3J1Yy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFZQSw0Q0FBNEM7QUFDNUMsMkJBQTJCO0FBQzNCLGtDQUFvRDtBQUdwRCxTQUFTLEtBQUssQ0FBQyxLQUFhO0lBQzFCLE9BQU8sY0FBTyxDQUFDLFlBQVksQ0FBQyxLQUFLLEVBQUUsS0FBSyxDQUFDLENBQUM7QUFDNUMsQ0FBQztBQUVELE1BQU0sSUFBSSxHQUFjO0lBQ3RCLE9BQU8sQ0FBQyxLQUFhO1FBQ25CLE1BQU0sQ0FBQyxLQUFLLEVBQUUsR0FBRyxDQUFDLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBRWxDLElBQUksR0FBRyxFQUFFO1lBQ1AsTUFBTSxHQUFHLENBQUM7U0FDWDtRQUVELE9BQU8sS0FBSyxDQUFDO0lBQ2YsQ0FBQztJQUVELE1BQU0sQ0FBQyxLQUFhO1FBQ2xCLE1BQU0sQ0FBQyxLQUFLLENBQUMsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFN0IsT0FBTyxjQUFPLENBQUMsT0FBTyxDQUFDL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VBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztnQkFDdkMsT0FBTyxFQUFFLEVBQUU7YUFDWixDQUFDLEtBQUssQ0FBQyxFQUNSO2dCQUNBLE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxlQUFlLEVBQUUsRUFBRSxDQUFDO2FBQ3BFO1NBQ0Y7YUFBTTtZQUNMLE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxnQkFBZ0IsRUFBRSxFQUFFLENBQUM7U0FDckU7UUFFRCxPQUFPO1lBQ0wsT0FBTyxFQUFFLElBQUk7WUFDYixPQUFPLEVBQUUsS0FBSztZQUNkLFlBQVksRUFBRSxLQUFLO1lBQ25CLFNBQVMsRUFBRSxJQUFJO1NBQ2hCLENBQUM7SUFDSixDQUFDO0NBQ0YsQ0FBQztBQUVhLGdCQUFRLEdBQXNCLElBQUksV0FBeEIsY0FBTSxHQUFjLElBQUksU0FBaEIsZUFBTyxHQUFLLElBQUksU0FBQyJ9 |
"use strict"; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9 | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stdnum = void 0; | ||
const br = require("./br"); | ||
exports.stdnum = { | ||
br, | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkJBQTJCO0FBSWQsUUFBQSxNQUFNLEdBQUc7SUFDcEIsRUFBRTtDQUNILENBQUMifQ== |
@@ -19,3 +19,4 @@ "use strict"; | ||
format(input) { | ||
return this.compact(input); | ||
const [value] = clean(input); | ||
return value; | ||
}, | ||
@@ -44,3 +45,6 @@ validate(input) { | ||
const sum = (10 - | ||
util_1.weightedChecksum(value, [3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7], 10)) % | ||
util_1.weightedSum(value.substr(0, 17), { | ||
weights: [3, 7, 1], | ||
modulus: 10, | ||
})) % | ||
10; | ||
@@ -59,2 +63,2 @@ if (checksum !== String(sum)) { | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhYmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbXgvY2xhYmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBY0EsNENBQTRDO0FBQzVDLGtDQUFvRDtBQUVwRCxtQ0FBMkM7QUFFM0MsU0FBUyxLQUFLLENBQUMsS0FBYTtJQUMxQixPQUFPLGNBQU8sQ0FBQyxZQUFZLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQzNDLENBQUM7QUFFRCxNQUFNLElBQUksR0FBYztJQUN0QixPQUFPLENBQUMsS0FBYTtRQUNuQixNQUFNLENBQUMsS0FBSyxFQUFFLEdBQUcsQ0FBQyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUVsQyxJQUFJLEdBQUcsRUFBRTtZQUNQLE1BQU0sR0FBRyxDQUFDO1NBQ1g7UUFFRCxPQUFPLEtBQUssQ0FBQyxpQkFBaUIsRUFBRSxDQUFDO0lBQ25DLENBQUM7SUFFRCxNQUFNLENBQUMsS0FBYTtRQUNsQixPQUFPLElBQUksQ0FBQyxPQUFPLENBQ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FFBQVEsQ0FBQyxPQUFPLENBQUMsRUFBRTtZQUM5QixPQUFPLEVBQUUsT0FBTyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsSUFBSSxVQUFVLENBQUMsZ0JBQWdCLEVBQUUsRUFBRSxDQUFDO1NBQ3JFO1FBRUQsTUFBTSxHQUFHLEdBQ1AsQ0FBQyxFQUFFO1lBQ0Qsa0JBQVcsQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsRUFBRTtnQkFDL0IsT0FBTyxFQUFFLENBQUMsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7Z0JBQ2xCLE9BQU8sRUFBRSxFQUFFO2FBQ1osQ0FBQyxDQUFDO1lBQ0wsRUFBRSxDQUFDO1FBRUwsSUFBSSxRQUFRLEtBQUssTUFBTSxDQUFDLEdBQUcsQ0FBQyxFQUFFO1lBQzVCLE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxlQUFlLEVBQUUsRUFBRSxDQUFDO1NBQ3BFO1FBTUQsT0FBTztZQUNMLE9BQU8sRUFBRSxJQUFJO1lBQ2IsT0FBTyxFQUFFLEtBQUs7WUFDZCxZQUFZLEVBQUUsS0FBSztZQUNuQixTQUFTLEVBQUUsS0FBSztTQUNqQixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFYSxnQkFBUSxHQUFzQixJQUFJLFdBQXhCLGNBQU0sR0FBYyxJQUFJLFNBQWhCLGVBQU8sR0FBSyxJQUFJLFNBQUMifQ== |
@@ -140,3 +140,4 @@ "use strict"; | ||
format(input) { | ||
return this.compact(input); | ||
const [value] = clean(input); | ||
return value; | ||
}, | ||
@@ -203,2 +204,2 @@ validate(input) { | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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 @@ "use strict"; | ||
format(input) { | ||
const value = this.compact(input); | ||
const [value] = clean(input); | ||
if (value.length === 12) { | ||
@@ -124,2 +124,2 @@ return util_1.strings.splitAt(value, 3, 9).join(' '); | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmZjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL214L3JmYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUE4QkEsNENBQTRDO0FBQzVDLGtDQUE0RDtBQUc1RCxTQUFTLEtBQUssQ0FBQyxLQUFhO0lBQzFCLE9BQU8sY0FBTyxDQUFDLFlBQVksQ0FBQyxLQUFLLEVBQUUsS0FBSyxDQUFDLENBQUM7QUFDNUMsQ0FBQztBQUVELE1BQU0sYUFBYSxHQUFHLElBQUksR0FBRyxDQUFDO0lBQzVCLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFN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BQUMsS0FBSyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsS0FBSyxNQUFNLENBQUMsRUFBRSxHQUFHLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQyxDQUFDLEVBQUU7Z0JBQ3ZELE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxlQUFlLEVBQUUsRUFBRSxDQUFDO2FBQ3BFO1NBQ0Y7UUFFRCxPQUFPO1lBQ0wsT0FBTyxFQUFFLElBQUk7WUFDYixPQUFPLEVBQUUsS0FBSztZQUNkLFlBQVksRUFBRSxLQUFLLENBQUMsTUFBTSxLQUFLLEVBQUU7WUFDakMsU0FBUyxFQUFFLEtBQUssQ0FBQyxNQUFNLEtBQUssRUFBRTtTQUMvQixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFYSxnQkFBUSxHQUFzQixJQUFJLFdBQXhCLGNBQU0sR0FBYyxJQUFJLFNBQWhCLGVBQU8sR0FBSyxJQUFJLFNBQUMifQ== |
@@ -18,3 +18,4 @@ "use strict"; | ||
format(input) { | ||
return this.compact(input); | ||
const [value] = clean(input); | ||
return value; | ||
}, | ||
@@ -33,26 +34,21 @@ validate(input) { | ||
let digit; | ||
const [front, check] = util_1.strings.splitAt(value, value.length === 10 ? -1 : -2); | ||
if (value.length === 10) { | ||
const d1 = (util_1.weightedChecksum(value, [2, 4, 10, 3, 5, 9, 4, 6, 8]) % 11) % 10; | ||
digit = `${d1}`; | ||
digit = String(util_1.weightedSum(front, { | ||
weights: [2, 4, 10, 3, 5, 9, 4, 6, 8], | ||
modulus: 11, | ||
}) % 10); | ||
} | ||
else { | ||
const d1 = (util_1.weightedChecksum(value, [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]) % 11) % 10; | ||
const d2 = (util_1.weightedChecksum(value.substr(0, 10) + d1, [ | ||
3, | ||
7, | ||
2, | ||
4, | ||
10, | ||
3, | ||
5, | ||
9, | ||
4, | ||
6, | ||
8, | ||
]) % | ||
11) % | ||
10; | ||
const d1 = String(util_1.weightedSum(front, { | ||
weights: [7, 2, 4, 10, 3, 5, 9, 4, 6, 8], | ||
modulus: 11, | ||
}) % 10); | ||
const d2 = String(util_1.weightedSum(front + d1, { | ||
weights: [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8], | ||
modulus: 11, | ||
}) % 10); | ||
digit = `${d1}${d2}`; | ||
} | ||
if (digit !== value.substr(value.length - digit.length)) { | ||
if (digit !== check) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
@@ -69,2 +65,2 @@ } | ||
exports.validate = impl.validate, exports.format = impl.format, exports.compact = impl.compact; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3J1L2lubi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFhQSw0Q0FBNEM7QUFDNUMsa0NBQW9EO0FBR3BELFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsT0FBTyxjQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsQ0FBQztBQUMxQyxDQUFDO0FBRUQsTUFBTSxJQUFJLEdBQWM7SUFDdEIsT0FBTyxDQUFDLEtBQWE7UUFDbkIsTUFBTSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFbEMsSUFBSSxHQUFHLEVBQUU7WUFDUCxNQUFNLEdBQUcsQ0FBQztTQUNYO1FBRUQsT0FBTyxLQUFLLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztJQUNuQyxDQUFDO0lBRUQsTUFBTSxDQUFDLEtBQWE7UUFDbEIsT0FBTyxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQ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FDO0FBRWEsZ0JBQVEsR0FBc0IsSUFBSSxXQUF4QixjQUFNLEdBQWMsSUFBSSxTQUFoQixlQUFPLEdBQUssSUFBSSxTQUFDIn0= |
@@ -1,5 +0,10 @@ | ||
export declare function weightedChecksum(value: string, weights: number[], modulus?: number): number; | ||
export declare function weightedSum(value: string, { alphabet, reverse, weights, modulus, }: { | ||
alphabet?: string; | ||
reverse?: boolean; | ||
modulus?: number; | ||
weights?: number[]; | ||
}): number; | ||
export declare function luhnChecksum(value: string, alphabet?: string): number; | ||
export declare function luhnChecksumValidate(value: string, alphabet?: string): number; | ||
export declare function luhnChecksumValidate(value: string, alphabet?: string): boolean; | ||
export declare function luhnChecksumValue(value: string, alphabet?: string): number; | ||
export declare function luhnChecksumDigit(value: string, alphabet?: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.luhnChecksumDigit = exports.luhnChecksumValue = exports.luhnChecksumValidate = exports.luhnChecksum = exports.weightedChecksum = void 0; | ||
function weightedChecksum(value, weights, modulus) { | ||
const weighted = value.split('').reduce((acc, v, idx) => { | ||
if (idx >= weights.length) { | ||
return acc; | ||
} | ||
const wv = parseInt(v, 10) * weights[idx]; | ||
return acc + (modulus ? wv % modulus : wv); | ||
}, 0); | ||
return modulus ? weighted % modulus : weighted; | ||
exports.luhnChecksumDigit = exports.luhnChecksumValue = exports.luhnChecksumValidate = exports.luhnChecksum = exports.weightedSum = void 0; | ||
function weightedSum(value, { alphabet = '0123456789', reverse = false, weights = [1], modulus = 0, }) { | ||
const wlen = weights.length; | ||
const numbers = value.split('').map(v => alphabet.indexOf(v)); | ||
const weighted = (reverse ? numbers.reverse() : numbers).map((v, idx) => v * weights[idx % wlen]); | ||
return weighted.reduce((acc, v) => (modulus ? (acc + v) % modulus : acc + v), 0); | ||
} | ||
exports.weightedChecksum = weightedChecksum; | ||
exports.weightedSum = weightedSum; | ||
function luhnChecksum(value, alphabet = '0123456789') { | ||
@@ -38,3 +34,3 @@ const parity = value.length % 2; | ||
}, 0); | ||
return sum % alphabet.length; | ||
return sum % alphabet.length === 0; | ||
} | ||
@@ -61,2 +57,2 @@ exports.luhnChecksumValidate = luhnChecksumValidate; | ||
exports.luhnChecksumDigit = luhnChecksumDigit; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tzdW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbC9jaGVja3N1bS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSxTQUFnQixnQkFBZ0IsQ0FDOUIsS0FBYSxFQUNiLE9BQWlCLEVBQ2pCLE9BQWdCO0lBRWhCLE1BQU0sUUFBUSxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsR0FBRyxFQUFFLENBQUMsRUFBRSxHQUFHLEVBQUUsRUFBRTtRQUN0RCxJQUFJLEdBQUcsSUFBSSxPQUFPLENBQUMsTUFBTSxFQUFFO1lBQ3pCLE9BQU8sR0FBRyxDQUFDO1NBQ1o7UUFDRCxNQUFNLEVBQUUsR0FBRyxRQUFRLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUUxQyxPQUFPLEdBQUcsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUM7SUFDN0MsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDO0lBRU4sT0FBTyxPQUFPLENBQUMsQ0FBQyxDQUFDLFFBQVEsR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLFFBQVEsQ0FBQztBQUNqRCxDQUFDO0FBZkQsNENBZUM7QUFFRCxTQUFnQixZQUFZLENBQUMsS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LFFBQVEsQ0FBQyxRQUFRLENBQUMsTUFBTSxHQUFHLEVBQUUsQ0FBQyxDQUFDO0FBQ3hDLENBQUM7QUFQRCw4Q0FPQyJ9 |
import * as strings from './strings'; | ||
export { weightedChecksum } from './checksum'; | ||
export { weightedSum } from './checksum'; | ||
export { isValidDate, isValidDateCompactYYMMDD, isValidDateCompactDDMMYY, } from './isValidDate'; | ||
export { strings }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.strings = exports.isValidDateCompactDDMMYY = exports.isValidDateCompactYYMMDD = exports.isValidDate = exports.weightedChecksum = void 0; | ||
exports.strings = exports.isValidDateCompactDDMMYY = exports.isValidDateCompactYYMMDD = exports.isValidDate = exports.weightedSum = void 0; | ||
const strings = require("./strings"); | ||
exports.strings = strings; | ||
var checksum_1 = require("./checksum"); | ||
Object.defineProperty(exports, "weightedChecksum", { enumerable: true, get: function () { return checksum_1.weightedChecksum; } }); | ||
Object.defineProperty(exports, "weightedSum", { enumerable: true, get: function () { return checksum_1.weightedSum; } }); | ||
var isValidDate_1 = require("./isValidDate"); | ||
@@ -12,2 +12,2 @@ Object.defineProperty(exports, "isValidDate", { enumerable: true, get: function () { return isValidDate_1.isValidDate; } }); | ||
Object.defineProperty(exports, "isValidDateCompactDDMMYY", { enumerable: true, get: function () { return isValidDate_1.isValidDateCompactDDMMYY; } }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxxQ0FBcUM7QUFTNUIsMEJBQU87QUFQaEIsdUNBQThDO0FBQXJDLDRHQUFBLGdCQUFnQixPQUFBO0FBQ3pCLDZDQUl1QjtBQUhyQiwwR0FBQSxXQUFXLE9BQUE7QUFDWCx1SEFBQSx3QkFBd0IsT0FBQTtBQUN4Qix1SEFBQSx3QkFBd0IsT0FBQSJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxxQ0FBcUM7QUFTNUIsMEJBQU87QUFQaEIsdUNBQXlDO0FBQWhDLHVHQUFBLFdBQVcsT0FBQTtBQUNwQiw2Q0FJdUI7QUFIckIsMEdBQUEsV0FBVyxPQUFBO0FBQ1gsdUhBQUEsd0JBQXdCLE9BQUE7QUFDeEIsdUhBQUEsd0JBQXdCLE9BQUEifQ== |
@@ -5,5 +5,10 @@ "use strict"; | ||
function splitAt(value, ...points) { | ||
return [0, ...points].map((p, idx) => { var _a; return value.substr(p, ((_a = points[idx]) !== null && _a !== void 0 ? _a : value.length) - p); }); | ||
return [0, ...points].map((p, idx) => { | ||
const nvalue = idx >= points.length ? value.length : points[idx]; | ||
const np = nvalue < 0 ? value.length + nvalue : nvalue; | ||
const pp = p < 0 ? value.length + p : p; | ||
return value.substr(pp, np - pp); | ||
}); | ||
} | ||
exports.splitAt = splitAt; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BsaXRBdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy91dGlsL3N0cmluZ3Mvc3BsaXRBdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFLQSxTQUFnQixPQUFPLENBQUMsS0FBYSxFQUFFLEdBQUcsTUFBZ0I7SUFDeEQsT0FBTyxDQUFDLENBQUMsRUFBRSxHQUFHLE1BQU0sQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxHQUFHLEVBQUUsRUFBR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QUMsRUFBRSxFQUFFLEVBQUUsR0FBRyxFQUFFLENBQUMsQ0FBQztJQUNuQyxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUM7QUFSRCwwQkFRQyJ9 |
@@ -15,4 +15,4 @@ import * as exceptions from '../exceptions'; | ||
format(input) { | ||
const value = this.compact(input); | ||
return strings.formatPattern('?-??????-?', value); | ||
const [value] = clean(input); | ||
return strings.splitAt(value, 1, 7).join('-'); | ||
}, | ||
@@ -52,2 +52,2 @@ validate(value) { | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FkL25ydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlQSxPQUFPLEtBQUssVUFBVSxNQUFNLGVBQWUsQ0FBQztBQUM1QyxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sU0FBUyxDQUFDO0FBR2xDLFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsT0FBTyxPQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxLQUFLLENBQUMsQ0FBQztBQUM1QyxDQUFDO0FBRUQsTUFBTSxJQUFJLEdBQWM7SUFDdEIsT0FBTyxDQUFDLEtBQWE7UUFDbkIsTUFBTSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFbEMsSUFBSSxHQUFHLEVBQUU7WUFDUCxNQUFNLEdBQUcsQ0FBQztTQUNYO1FBRUQsT0FBTyxLQUFLLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztJQUNuQyxDQUFDO0lBRUQsTUFBTSxDQUFDLEtBQWE7UUFDbEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQztRQ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VSxDQUFDLGdCQUFnQixFQUFFLEVBQUUsQ0FBQztTQUNyRTtRQUNELElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLEdBQUcsSUFBSSxHQUFHLEdBQUcsUUFBUSxFQUFFO1lBQ2xDLE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxnQkFBZ0IsRUFBRSxFQUFFLENBQUM7U0FDckU7UUFDRCxJQUFJLElBQUksQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksR0FBRyxHQUFHLFFBQVEsSUFBSSxHQUFHLEdBQUcsUUFBUSxFQUFFO1lBQzNELE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxnQkFBZ0IsRUFBRSxFQUFFLENBQUM7U0FDckU7UUFFRCxPQUFPO1lBQ0wsT0FBTyxFQUFFLElBQUk7WUFDYixPQUFPLEVBQUUsQ0FBQztZQUNWLFlBQVksRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUNqQyxTQUFTLEVBQUUsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztTQUNoQyxDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLEdBQUcsSUFBSSxDQUFDIn0= |
import * as exceptions from '../exceptions'; | ||
import { strings, weightedChecksum } from '../util'; | ||
import { strings, weightedSum } from '../util'; | ||
function clean(input) { | ||
@@ -31,11 +31,17 @@ return strings.cleanUnicode(input, ' -'); | ||
const [front, c1, back, c2] = strings.splitAt(value, 7, 8, 21); | ||
const s1 = String(10 - weightedChecksum(strings.reverse(front), [3, 1, 7, 9, 3, 1, 7], 10)); | ||
const s1 = String(10 - | ||
weightedSum(front, { | ||
reverse: true, | ||
weights: [3, 1, 7, 9, 3, 1, 7], | ||
modulus: 10, | ||
})); | ||
const s2 = String(10 - | ||
weightedChecksum(strings.reverse(back), [3, 1, 7, 9, 3, 1, 7, 9, 3, 1, 7, 9, 3, 1], 10)); | ||
if (s1 !== c1) { | ||
weightedSum(back, { | ||
reverse: true, | ||
weights: [3, 1, 7, 9, 3, 1, 7, 9, 3, 1, 7, 9, 3, 1], | ||
modulus: 10, | ||
})); | ||
if (s1 !== c1 || s2 !== c2) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
} | ||
if (s2 !== c2) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
} | ||
return { | ||
@@ -50,2 +56,2 @@ isValid: true, | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2J1LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FyL2NidS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlQSxPQUFPLEtBQUssVUFBVSxNQUFNLGVBQWUsQ0FBQztBQUM1QyxPQUFPLEVBQUUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sU0FBUyxDQUFDO0FBR3BELFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsT0FBTyxPQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztBQUMzQyxDQUFDO0FBRUQsTUFBTSxJQUFJLEdBQWM7SUFDdEIsT0FBTyxDQUFDLEtBQWE7UUFDbkIsTUFBTSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFbEMsSUFBSSxHQUFHLEV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QUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztnQkFDOUIsT0FBTyxFQUFFLEVBQUU7YUFDWixDQUFDLENBQ0wsQ0FBQztRQUNGLE1BQU0sRUFBRSxHQUFHLE1BQU0sQ0FDZixFQUFFO1lBQ0EsV0FBVyxDQUFDLElBQUksRUFBRTtnQkFDaEIsT0FBTyxFQUFFLElBQUk7Z0JBQ2IsT0FBTyxFQUFFLENBQUMsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztnQkFDbkQsT0FBTyxFQUFFLEVBQUU7YUFDWixDQUFDLENBQ0wsQ0FBQztRQUVGLElBQUksRUFBRSxLQUFLLEVBQUUsSUFBSSxFQUFFLEtBQUssRUFBRSxFQUFFO1lBQzFCLE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxlQUFlLEVBQUUsRUFBRSxDQUFDO1NBQ3BFO1FBRUQsT0FBTztZQUNMLE9BQU8sRUFBRSxJQUFJO1lBQ2IsT0FBTyxFQUFFLEtBQUs7WUFDZCxZQUFZLEVBQUUsS0FBSztZQUNuQixTQUFTLEVBQUUsS0FBSztTQUNqQixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLEdBQUcsSUFBSSxDQUFDIn0= |
import * as exceptions from '../exceptions'; | ||
import { strings, weightedChecksum } from '../util'; | ||
import { strings, weightedSum } from '../util'; | ||
const cuitTypes = [ | ||
@@ -45,3 +45,6 @@ '20', | ||
} | ||
const cs = weightedChecksum(front + body, [5, 4, 3, 2, 7, 6, 5, 4, 3, 2], 11); | ||
const cs = weightedSum(front + body, { | ||
weights: [5, 4, 3, 2, 7, 6, 5, 4, 3, 2], | ||
modulus: 11, | ||
}); | ||
const digit = '012345678990'[11 - cs]; | ||
@@ -60,2 +63,2 @@ if (digit !== check) { | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hci9jdWl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWFBLE9BQU8sS0FBSyxVQUFVLE1BQU0sZUFBZSxDQUFDO0FBQzVDLE9BQU8sRUFBRSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxTQUFTLENBQUM7QUFHcEQsTUFBTSxTQUFTLEdBQUc7SUFFaEIsSUFBSTtJQUNKLElBQUk7SUFDSixJQUFJO0lBQ0osSUFBSTtJQUVKLElBQUk7SUFDSixJQUFJO0lBQ0osSUFBSTtJQUVKLElBQUk7SUFDSixJQUFJO0lBQ0osSUFBSTtDQUNMLENBQUM7QUFFRixTQUFTLEtBQUssQ0FBQyxLQUFhO0lBQzFCLE9BQU8sT0FBTyxDQUFDLFlBQVksQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFDM0MsQ0FBQztBQUVELE1BQU0sSUFBSSxHQUFjO0lBQ3RCLE9BQU8sQ0FBQyxLQUFhO1FBQ25CLE1BQU0sQ0FBQyxLQUFLLEVBQUUsR0FBRyxDQUFDLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBRWxDLElBQUksR0FBRyxFQUFFO1lBQ1AsTUFBTSxHQUFHLENBQUM7U0FDWDtRQUVELE9BQU8sS0FBSyxDQUFDO0lBQ2YsQ0FBQztJQUVELE1BQU0sQ0FBQyxLQUFhO1FBQ2xCLE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yxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUMsQ0FBQztRQUV0QyxJQUFJLEtBQUssS0FBSyxLQUFLLEVBQUU7WUFDbkIsT0FBTyxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLElBQUksVUFBVSxDQUFDLGVBQWUsRUFBRSxFQUFFLENBQUM7U0FDcEU7UUFFRCxPQUFPO1lBQ0wsT0FBTyxFQUFFLElBQUk7WUFDYixPQUFPLEVBQUUsS0FBSztZQUNkLFlBQVksRUFBRSxLQUFLLENBQUMsQ0FBQyxDQUFDLEtBQUssR0FBRztZQUM5QixTQUFTLEVBQUUsS0FBSyxDQUFDLENBQUMsQ0FBQyxLQUFLLEdBQUc7U0FDNUIsQ0FBQztJQUNKLENBQUM7Q0FDRixDQUFDO0FBRUYsTUFBTSxDQUFDLE1BQU0sRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxHQUFHLElBQUksQ0FBQyJ9 |
import * as exceptions from '../exceptions'; | ||
import { isValidDateCompactDDMMYY, strings, weightedChecksum } from '../util'; | ||
import { isValidDateCompactDDMMYY, strings, weightedSum } from '../util'; | ||
function clean(input) { | ||
@@ -33,3 +33,6 @@ return strings.cleanUnicode(input, ' -'); | ||
} | ||
const sum = weightedChecksum(`${front}${dob}`, [3, 7, 9, 5, 8, 4, 2, 1, 6], 11); | ||
const sum = weightedSum(`${front}${dob}`, { | ||
weights: [3, 7, 9, 5, 8, 4, 2, 1, 6], | ||
modulus: 11, | ||
}); | ||
const digit = String(sum % 11); | ||
@@ -48,2 +51,2 @@ if (check !== digit) { | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidm5yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2F0L3Zuci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlQSxPQUF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, weightedSum } from '../util'; | ||
function clean(input) { | ||
@@ -38,3 +38,7 @@ const [v, err] = strings.cleanUnicode(input, ' -'); | ||
} | ||
const sum = weightedChecksum(strings.reverse(front), [9, 8, 7, 6, 5, 4, 9, 8, 7], 11); | ||
const sum = weightedSum(front, { | ||
reverse: true, | ||
weights: [9, 8, 7, 6, 5, 4, 9, 8, 7], | ||
modulus: 11, | ||
}); | ||
const digit = '0123456789K'[sum]; | ||
@@ -53,2 +57,2 @@ if (check !== digit) { | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnV0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsL3J1dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFXQSxPQUFPLEtBQUssVUFBVSxNQUFNLGVBQWUsQ0FBQztBQUM1QyxPQUFPLEVBQUUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sU0FBUyxDQUFDO0FBR3BELFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsTUFBTSxDQUFDLENBQUMsRUFBRSxHQUFHLENBQUMsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztJQUVuRCxJQUFJLEdBQUcsRUFBRTtRQUNQLE9BQU8sQ0FBQyxFQUFFLEVBQUUsR0FBRyxDQUFDLENBQUM7S0FDbEI7SUFFRCxJQUFJLENBQUMsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLEVBQUU7UUFDdEIsT0FBTyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsSUFBSSxDQUFDLENBQUM7S0FDNUI7SUFFRCxPQUFPLENBQUMsQ0FBQyxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQ25CLENBQUM7QUFFRCxNQUFNLElBQUksR0FBY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FRCxNQUFNLEdBQUcsR0FBRyxXQUFXLENBQUMsS0FBSyxFQUFFO1lBQzdCLE9BQU8sRUFBRSxJQUFJO1lBQ2IsT0FBTyxFQUFFLENBQUMsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7WUFDcEMsT0FBTyxFQUFFLEVBQUU7U0FDWixDQUFDLENBQUM7UUFFSCxNQUFNLEtBQUssR0FBRyxhQUFhLENBQUMsR0FBRyxDQUFDLENBQUM7UUFFakMsSUFBSSxLQUFLLEtBQUssS0FBSyxFQUFFO1lBQ25CLE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxlQUFlLEVBQUUsRUFBRSxDQUFDO1NBQ3BFO1FBRUQsT0FBTztZQUNMLE9BQU8sRUFBRSxJQUFJO1lBQ2IsT0FBTyxFQUFFLEtBQUs7WUFDZCxZQUFZLEVBQUUsS0FBSztZQUNuQixTQUFTLEVBQUUsS0FBSztTQUNqQixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLEdBQUcsSUFBSSxDQUFDIn0= |
import * as exceptions from '../exceptions'; | ||
import { strings, weightedChecksum } from '../util'; | ||
import { strings, weightedSum } from '../util'; | ||
function clean(input) { | ||
@@ -30,5 +30,9 @@ return strings.cleanUnicode(input, ',.- '); | ||
} | ||
const sum = weightedChecksum(value, [71, 67, 59, 53, 47, 43, 41, 37, 29, 23, 19, 17, 13, 7, 3].slice(16 - value.length)) % 11; | ||
const digit = '01987654321'.split('')[sum]; | ||
if (value[value.length - 1] !== digit) { | ||
const [front, check] = strings.splitAt(value, -1); | ||
const sum = weightedSum(front, { | ||
weights: [71, 67, 59, 53, 47, 43, 41, 37, 29, 23, 19, 17, 13, 7, 3].slice(16 - front.length), | ||
modulus: 11, | ||
}); | ||
const digit = '01987654321'[sum]; | ||
if (check !== digit) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
@@ -45,2 +49,2 @@ } | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibml0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvL25pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFjQSxPQUFPLEtBQUssVUFBVSxNQUFNLGVBQWUsQ0FBQztBQUM1QyxPQUFPLEVBQUUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sU0FBUyxDQUFDO0FBR3BELFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsT0FBTyxPQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxNQUFNLENBQUMsQ0FBQztBQUM3QyxDQUFDO0FBRUQsTUFBTSxJQUFJLEdBQWM7SUFDdEIsT0FBTyxDQUFDLEtBQWE7UUFDbkIsTUFBTSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFbEMsSUFBSSxHQUFHLEVBQUU7WUFDUCxNQUFNLEdBQUcsQ0FBQztTQUNYO1FBRUQsT0FBTyxLQUFLLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztJQUNuQyxDQUFDO0lBRUQsTUFBTSxDQUFDLEtBQWE7UUFDbEIsTUFBTSxDQUFDLEtBQUssQ0FBQyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUU3QixNQUFNLENBQUMsRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxDQUFDLEdBQUcsT0FBTyxDQUFDLE9BQ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S0FBSztZQUNuQixTQUFTLEVBQUUsS0FBSztTQUNqQixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLEdBQUcsSUFBSSxDQUFDIn0= |
import * as exceptions from '../exceptions'; | ||
import * as ci from './ci'; | ||
import { strings, weightedChecksum } from '../util'; | ||
import { strings, weightedSum } from '../util'; | ||
function clean(input) { | ||
@@ -45,3 +45,6 @@ return strings.cleanUnicode(input, ' -.'); | ||
} | ||
if (weightedChecksum(front, [3, 2, 7, 6, 5, 4, 3, 2, 1], 11) !== 0) { | ||
if (weightedSum(front, { | ||
weights: [3, 2, 7, 6, 5, 4, 3, 2, 1], | ||
modulus: 11, | ||
}) !== 0) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
@@ -55,3 +58,6 @@ } | ||
} | ||
if (weightedChecksum(front, [4, 3, 2, 7, 6, 5, 4, 3, 2, 1], 11) !== 0) { | ||
if (weightedSum(front, { | ||
weights: [4, 3, 2, 7, 6, 5, 4, 3, 2, 1], | ||
modulus: 11, | ||
}) !== 0) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
@@ -72,2 +78,2 @@ } | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2VjL3J1Yy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFZQSxPQUFPLEtBQUssVUFBVSxNQUFNLGVBQWUsQ0FBQztBQUM1QyxPQUFPLEtBQUssRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUMzQixPQUFPLEVBQUUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sU0FBUyxDQUFDO0FBR3BELFNBQVMsS0FBSyxDQU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QUFTLEVBQUUsSUFBSTtTQUNoQixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLEdBQUcsSUFBSSxDQUFDIn0= |
@@ -1,2 +0,5 @@ | ||
"use strict"; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9 | ||
import * as br from './br'; | ||
export const stdnum = { | ||
br, | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFJM0IsTUFBTSxDQUFDLE1BQU0sTUFBTSxHQUFHO0lBQ3BCLEVBQUU7Q0FDSCxDQUFDIn0= |
import * as exceptions from '../exceptions'; | ||
import { strings, weightedChecksum } from '../util'; | ||
import { strings, weightedSum } from '../util'; | ||
import { banksMap, cities } from './banks'; | ||
@@ -16,3 +16,4 @@ function clean(input) { | ||
format(input) { | ||
return this.compact(input); | ||
const [value] = clean(input); | ||
return value; | ||
}, | ||
@@ -41,3 +42,6 @@ validate(input) { | ||
const sum = (10 - | ||
weightedChecksum(value, [3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7], 10)) % | ||
weightedSum(value.substr(0, 17), { | ||
weights: [3, 7, 1], | ||
modulus: 10, | ||
})) % | ||
10; | ||
@@ -56,2 +60,2 @@ if (checksum !== String(sum)) { | ||
export const { validate, format, compact } = impl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BRSxFQUFFLENBQUM7U0FDckU7UUFFRCxNQUFNLEdBQUcsR0FDUCxDQUFDLEVBQUU7WUFDRCxXQUFXLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDLEVBQUU7Z0JBQy9CLE9BQU8sRUFBRSxDQUFDLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDO2dCQUNsQixPQUFPLEVBQUUsRUFBRTthQUNaLENBQUMsQ0FBQztZQUNMLEVBQUUsQ0FBQztRQUVMLElBQUksUUFBUSxLQUFLLE1BQU0sQ0FBQyxHQUFHLENBQUMsRUFBRTtZQUM1QixPQUFPLEVBQUUsT0FBTyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsSUFBSSxVQUFVLENBQUMsZUFBZSxFQUFFLEVBQUUsQ0FBQztTQUNwRTtRQU1ELE9BQU87WUFDTCxPQUFPLEVBQUUsSUFBSTtZQUNiLE9BQU8sRUFBRSxLQUFLO1lBQ2QsWUFBWSxFQUFFLEtBQUs7WUFDbkIsU0FBUyxFQUFFLEtBQUs7U0FDakIsQ0FBQztJQUNKLENBQUM7Q0FDRixDQUFDO0FBRUYsTUFBTSxDQUFDLE1BQU0sRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxHQUFHLElBQUksQ0FBQyJ9 |
@@ -137,3 +137,4 @@ import * as exceptions from '../exceptions'; | ||
format(input) { | ||
return this.compact(input); | ||
const [value] = clean(input); | ||
return value; | ||
}, | ||
@@ -198,2 +199,2 @@ validate(input) { | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9teC9jdXJwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWFBLE9BQU8sS0FBSyxVQUFVL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format(input) { | ||
const value = this.compact(input); | ||
const [value] = clean(input); | ||
if (value.length === 12) { | ||
@@ -121,2 +121,2 @@ return strings.splitAt(value, 3, 9).join(' '); | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmZjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL214L3JmYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE4QkEsT0FBTyxLQUFLLFVBQVUsTUFBTSxlQUFlLENBQUM7QUFDNUMsT0FBTyxFQUFFLHdCQUF3QixFQUFFLE9BQU8sRUFBRSxNQUFNLFNBQVMsQ0FBQztBQUc1RCxTQUFTLEtBQUssQ0FBQyxLQUFhO0lBQzFCLE9BQU8sT0FBTyxDQUFDLFlBQVksQ0FBQyxLQUFLLEVBQUUsS0FBSyxDQUFDLENBQUM7QUFDNUMsQ0FBQztBQUVELE1BQU0sYUFBYSxHQUFHLElBQUksR0FBRyxDQUFDO0lBQzVCLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixN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tQ0FBSSxDQUFDLENBQUMsR0FBRyxDQUFDLEVBQUUsR0FBRyxHQUFHLENBQUMsQ0FBQSxFQUFBLEVBQy9ELENBQUMsQ0FDRixDQUFDO1lBRUosSUFBSSxLQUFLLENBQUMsS0FBSyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsS0FBSyxNQUFNLENBQUMsRUFBRSxHQUFHLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQyxDQUFDLEVBQUU7Z0JBQ3ZELE9BQU8sRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsQ0FBQyxlQUFlLEVBQUUsRUFBRSxDQUFDO2FBQ3BFO1NBQ0Y7UUFFRCxPQUFPO1lBQ0wsT0FBTyxFQUFFLElBQUk7WUFDYixPQUFPLEVBQUUsS0FBSztZQUNkLFlBQVksRUFBRSxLQUFLLENBQUMsTUFBTSxLQUFLLEVBQUU7WUFDakMsU0FBUyxFQUFFLEtBQUssQ0FBQyxNQUFNLEtBQUssRUFBRTtTQUMvQixDQUFDO0lBQ0osQ0FBQztDQUNGLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLEdBQUcsSUFBSSxDQUFDIn0= |
import * as exceptions from '../exceptions'; | ||
import { strings, weightedChecksum } from '../util'; | ||
import { strings, weightedSum } from '../util'; | ||
function clean(input) { | ||
@@ -15,3 +15,4 @@ return strings.cleanUnicode(input, ' '); | ||
format(input) { | ||
return this.compact(input); | ||
const [value] = clean(input); | ||
return value; | ||
}, | ||
@@ -30,26 +31,21 @@ validate(input) { | ||
let digit; | ||
const [front, check] = strings.splitAt(value, value.length === 10 ? -1 : -2); | ||
if (value.length === 10) { | ||
const d1 = (weightedChecksum(value, [2, 4, 10, 3, 5, 9, 4, 6, 8]) % 11) % 10; | ||
digit = `${d1}`; | ||
digit = String(weightedSum(front, { | ||
weights: [2, 4, 10, 3, 5, 9, 4, 6, 8], | ||
modulus: 11, | ||
}) % 10); | ||
} | ||
else { | ||
const d1 = (weightedChecksum(value, [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]) % 11) % 10; | ||
const d2 = (weightedChecksum(value.substr(0, 10) + d1, [ | ||
3, | ||
7, | ||
2, | ||
4, | ||
10, | ||
3, | ||
5, | ||
9, | ||
4, | ||
6, | ||
8, | ||
]) % | ||
11) % | ||
10; | ||
const d1 = String(weightedSum(front, { | ||
weights: [7, 2, 4, 10, 3, 5, 9, 4, 6, 8], | ||
modulus: 11, | ||
}) % 10); | ||
const d2 = String(weightedSum(front + d1, { | ||
weights: [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8], | ||
modulus: 11, | ||
}) % 10); | ||
digit = `${d1}${d2}`; | ||
} | ||
if (digit !== value.substr(value.length - digit.length)) { | ||
if (digit !== check) { | ||
return { isValid: false, error: new exceptions.InvalidChecksum() }; | ||
@@ -66,2 +62,2 @@ } | ||
export const { validate, format, compact } = impl; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3J1L2lubi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFhQSxPQUFPLEtBQUssVUFBVSxNQUFNLGVBQWUsQ0FBQztBQUM1QyxPQUFPLEVBQUUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sU0FBUyxDQUFDO0FBR3BELFNBQVMsS0FBSyxDQUFDLEtBQWE7SUFDMUIsT0FBTyxPQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsQ0FBQztBQUMxQyxDQUFDO0FBRUQsTUFBTSxJQUFJLEdBQWM7SUFDdEIsT0FBTyxDQUFDLEtBQWE7UUFDbkIsTUFBTSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsR0FBRyx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sT0FBTyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsSUFBSSxVQUFVLENBQUMsZUFBZSxFQUFFLEVBQUUsQ0FBQztTQUNwRTtRQUVELE9BQU87WUFDTCxPQUFPLEVBQUUsSUFBSTtZQUNiLE9BQU8sRUFBRSxLQUFLO1lBQ2QsWUFBWSxFQUFFLEtBQUssQ0FBQyxNQUFNLEtBQUssRUFBRTtZQUNqQyxTQUFTLEVBQUUsS0FBSyxDQUFDLE1BQU0sS0FBSyxFQUFFO1NBQy9CLENBQUM7SUFDSixDQUFDO0NBQ0YsQ0FBQztBQUVGLE1BQU0sQ0FBQyxNQUFNLEVBQUUsUUFBUSxFQUFFLE1BQU0sRUFBRSxPQUFPLEVBQUUsR0FBRyxJQUFJLENBQUMifQ== |
@@ -1,5 +0,10 @@ | ||
export declare function weightedChecksum(value: string, weights: number[], modulus?: number): number; | ||
export declare function weightedSum(value: string, { alphabet, reverse, weights, modulus, }: { | ||
alphabet?: string; | ||
reverse?: boolean; | ||
modulus?: number; | ||
weights?: number[]; | ||
}): number; | ||
export declare function luhnChecksum(value: string, alphabet?: string): number; | ||
export declare function luhnChecksumValidate(value: string, alphabet?: string): number; | ||
export declare function luhnChecksumValidate(value: string, alphabet?: string): boolean; | ||
export declare function luhnChecksumValue(value: string, alphabet?: string): number; | ||
export declare function luhnChecksumDigit(value: string, alphabet?: string): string; |
@@ -1,10 +0,6 @@ | ||
export function weightedChecksum(value, weights, modulus) { | ||
const weighted = value.split('').reduce((acc, v, idx) => { | ||
if (idx >= weights.length) { | ||
return acc; | ||
} | ||
const wv = parseInt(v, 10) * weights[idx]; | ||
return acc + (modulus ? wv % modulus : wv); | ||
}, 0); | ||
return modulus ? weighted % modulus : weighted; | ||
export function weightedSum(value, { alphabet = '0123456789', reverse = false, weights = [1], modulus = 0, }) { | ||
const wlen = weights.length; | ||
const numbers = value.split('').map(v => alphabet.indexOf(v)); | ||
const weighted = (reverse ? numbers.reverse() : numbers).map((v, idx) => v * weights[idx % wlen]); | ||
return weighted.reduce((acc, v) => (modulus ? (acc + v) % modulus : acc + v), 0); | ||
} | ||
@@ -33,3 +29,3 @@ export function luhnChecksum(value, alphabet = '0123456789') { | ||
}, 0); | ||
return sum % alphabet.length; | ||
return sum % alphabet.length === 0; | ||
} | ||
@@ -53,2 +49,2 @@ export function luhnChecksumValue(value, alphabet = '0123456789') { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tzdW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbC9jaGVja3N1bS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxNQUFNLFVBQVUsZ0JBQWdCLENBQzlCLEtBQWEsRUFDYixPQUFpQixFQUNqQixPQUFnQjtJQUVoQixNQUFNLFFBQVEsR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLEdBQUcsRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFLEVBQUU7UUFDdEQsSUFBSSxHQUFHLElBQUksT0FBTyxDQUFDLE1BQU0sRUFBRTtZQUN6QixPQUFPLEdBQUcsQ0FBQztTQUNaO1FBQ0QsTUFBTSxFQUFFLEdBQUcsUUFBUSxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7UUFFMUMsT0FBTyxHQUFHLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDO0lBQzdDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQztJQUVOLE9BQU8sT0FBTyxDQUFDLENBQUMsQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxRQUF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RLENBQUMsTUFBTSxHQUFHLEVBQUUsQ0FBQyxDQUFDO0FBQ3hDLENBQUMifQ== |
import * as strings from './strings'; | ||
export { weightedChecksum } from './checksum'; | ||
export { weightedSum } from './checksum'; | ||
export { isValidDate, isValidDateCompactYYMMDD, isValidDateCompactDDMMYY, } from './isValidDate'; | ||
export { strings }; |
import * as strings from './strings'; | ||
export { weightedChecksum } from './checksum'; | ||
export { weightedSum } from './checksum'; | ||
export { isValidDate, isValidDateCompactYYMMDD, isValidDateCompactDDMMYY, } from './isValidDate'; | ||
export { strings }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLFdBQVcsQ0FBQztBQUVyQyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFDOUMsT0FBTyxFQUNMLFdBQVcsRUFDWCx3QkFBd0IsRUFDeEIsd0JBQXdCLEdBQ3pCLE1BQU0sZUFBZSxDQUFDO0FBRXZCLE9BQU8sRUFBRSxPQUFPLEVBQUUsQ0FBQyJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLFdBQVcsQ0FBQztBQUVyQyxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBQ3pDLE9BQU8sRUFDTCxXQUFXLEVBQ1gsd0JBQXdCLEVBQ3hCLHdCQUF3QixHQUN6QixNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUUsT0FBTyxFQUFFLENBQUMifQ== |
export function splitAt(value, ...points) { | ||
return [0, ...points].map((p, idx) => { var _a; return value.substr(p, ((_a = points[idx]) !== null && _a !== void 0 ? _a : value.length) - p); }); | ||
return [0, ...points].map((p, idx) => { | ||
const nvalue = idx >= points.length ? value.length : points[idx]; | ||
const np = nvalue < 0 ? value.length + nvalue : nvalue; | ||
const pp = p < 0 ? value.length + p : p; | ||
return value.substr(pp, np - pp); | ||
}); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BsaXRBdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy91dGlsL3N0cmluZ3Mvc3BsaXRBdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxNQUFNLFVBQVUsT0FBTyxDQUFDLEtBQWEsRUFBRSxHQUFHLE1BQWdCO0lBQ3hELE9BQU8sQ0FBQyxDQUFDLEVBQUUsR0FBRyxNQUFNLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsR0FBRyxFQUFFLEVBQUUsV0FDbkMsT0FBQSxLQUFLLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRSxPQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsbUNBQUksS0FBSyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFBLEVBQUEsQ0FDbkQsQ0FBQztBQUNKLENBQUMifQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BsaXRBdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy91dGlsL3N0cmluZ3Mvc3BsaXRBdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxNQUFNLFVBQVUsT0FBTyxDQUFDLEtBQWEsRUFBRSxHQUFHLE1BQWdCO0lBQ3hELE9BQU8sQ0FBQyxDQUFDLEVBQUUsR0FBRyxNQUFNLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsR0FBRyxFQUFFLEVBQUU7UUFDbkMsTUFBTSxNQUFNLEdBQUcsR0FBRyxJQUFJLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUNqRSxNQUFNLEVBQUUsR0FBRyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsTUFBTSxHQUFHLE1BQU0sQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDO1FBQ3ZELE1BQU0sRUFBRSxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFFeEMsT0FBTyxLQUFLLENBQUMsTUFBTSxDQUFDLEVBQUUsRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7SUFDbkMsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDIn0= |
{ | ||
"name": "stdnum", | ||
"version": "0.0.8", | ||
"version": "0.0.10", | ||
"description": "Standard Number Validation", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -10,28 +10,46 @@ # Country Standard Numbers | ||
| Country | Code | Name | Group | Meaning | | ||
| --------- | ---- | ---------- | -------- | ---------------------------------------------------------------- | | ||
| Andorra | AD | NRT | Tax | Tax Identifier (Número de Registre Tributari) | | ||
| Albania | AL | NIPT | Vat | Vat Identifier (Numri i Identifikimit për Personin e Tatueshëm) | | ||
| Argentina | AR | CBU | Bank | Bank Account (Clave Bancaria Uniforme) | | ||
| Argentina | AR | CUIT | Tax | Tax Identity (Código Único de Identificación Tributaria) | | ||
| Argentina | AR | DNI | Person | National Identity (Documento Nacional de Identidad) | | ||
| Austria | AT | Businessid | Business | Austrian Company Register Numbers | | ||
| Austria | AT | TIN | Tax | Austrian tax identification number (Abgabenkontonummer) | | ||
| Austria | AT | UID | VAT | Austrian VAT number (Umsatzsteuer-Identifikationsnummer) | | ||
| Austria | AT | VNR | Person | Austrian social security number(Versicherungsnummer) | | ||
| Brazil | BR | CPF | Person | Brazilian identity number (Cadastro de Pessoas Físicas) | | ||
| Brazil | BR | CNPJ | Company | Brazilian company number (Cadastro Nacional da Pessoa Jurídica) | | ||
| Chile | CL | RUT | Tax | Tax Identifier (Rol Unico Tributario) [RUN] | | ||
| Columbia | CO | NIT | Tax | Tax Identifier (Número de Identificación Tributaria) | | ||
| Ecuador | EC | CI | Person | Ecuadorian person identifier (Cédula de identidad) | | ||
| Ecuador | EC | RUC | Tax/Vat | Ecuadorian company tax number (Registro Único de Contribuyentes) | | ||
| Spain | ES | CIF | Tax/Vat | Tax Identifier (Código de Identificación Fiscal) | | ||
| Spain | ES | DNI | Person | Identity code (Documento Nacional de Identidad) | | ||
| Spain | ES | NIE | Person | Identity code foreigner (Número de Identificación de Extranjero) | | ||
| Spain | ES | NIF | Tax | Tax Identifier (Número de Identificación Fiscal) | | ||
| Mexico | MX | RFC | Tax/Vat | Tax Identifier (Registro Federal de Contribuyentes) | | ||
| Mexico | MX | CURP | Person | Individual Identifier (Clave Única de Registro de Población) | | ||
| Mexico | MX | CLABE | Bank | Bank Account (Clave Bancaria Estandarizada) | | ||
| Paraguay | PY | RUC | Tax/Vat | Tax Identifier (Registro Único de Contribuyentes) | | ||
| Russia | RU | INN | Tax/Vat | Tax Identifier (Идентификационный номер налогоплательщика) | | ||
| Country | Code | Name | Group | Meaning | | ||
| ------------------ | ---- | ---------- | -------------- | ------------------------------------------------------------------ | | ||
| Albania | AL | NIPT | Vat | Vat Identifier (Numri i Identifikimit për Personin e Tatueshëm) | | ||
| Andorra | AD | NRT | Tax | Tax Identifier (Número de Registre Tributari) | | ||
| Argentina | AR | CBU | Bank | Bank Account (Clave Bancaria Uniforme) | | ||
| Argentina | AR | CUIT | Tax | Tax Identity (Código Único de Identificación Tributaria) | | ||
| Argentina | AR | DNI | Person | National Identity (Documento Nacional de Identidad) | | ||
| Austria | AT | Businessid | Company | Austrian Company Register Numbers | | ||
| Austria | AT | TIN | Tax | Austrian tax identification number (Abgabenkontonummer) | | ||
| Austria | AT | UID | VAT | Austrian VAT number (Umsatzsteuer-Identifikationsnummer) | | ||
| Austria | AT | VNR | Person | Austrian social security number(Versicherungsnummer) | | ||
| Belize | BZ | TIN | Person/Company | Brazilian Tax ID () | | ||
| Brazil | BR | CPF | Person | Brazilian identity number (Cadastro de Pessoas Físicas) | | ||
| Brazil | BR | CNPJ | Company | Brazilian company number (Cadastro Nacional da Pessoa Jurídica) | | ||
| Canada | CA | BN | Company | Company Identifier (Canadian Business Number) | | ||
| Canada | CA | SIN | Person | Person Identifier (Social Insurance Number) | | ||
| Chile | CL | RUT | Tax | Tax Identifier (Rol Unico Tributario) [RUN] | | ||
| Columbia | CO | NIT | Tax | Tax Identifier (Número de Identificación Tributaria) | | ||
| Costa Rica | CR | CPF | Person | Person Identifier (Cédula de Persona Física) | | ||
| Costa Rica | CR | CPJ | Company | Company Identifier (Cédula de Persona Jurídica) | | ||
| Costa Rica | CR | CR | Person | Person Identifier (Cédula de Residencia) | | ||
| Dominican Republic | DO | CEDULA | Person | Person Identifier (Cédula de Residencia) | | ||
| Dominican Republic | DO | NCF | Vat | Tax Receipt Number (Números de Comprobante Fiscal) | | ||
| Dominican Republic | DO | RNC | Tax | Person Identifier (Registro Nacional del Contribuyente) | | ||
| Ecuador | EC | CI | Person | Ecuadorian person identifier (Cédula de identidad) | | ||
| Ecuador | EC | RUC | Tax/Vat | Ecuadorian company tax number (Registro Único de Contribuyentes) | | ||
| El Salvador | SV | NIT | Tax | Tax Identifier (Número de Identificación Tributaria) | | ||
| Guatemala | GT | CUI | Person | Guatemala person (Código Único de Identificación) | | ||
| Guatemala | GT | NIT | Company | Guatemala company tax number (Número de Identificación Tributaria) | | ||
| Mexico | MX | RFC | Tax/Vat | Tax Identifier (Registro Federal de Contribuyentes) | | ||
| Mexico | MX | CURP | Person | Individual Identifier (Clave Única de Registro de Población) | | ||
| Mexico | MX | CLABE | Bank | Bank Account (Clave Bancaria Estandarizada) | | ||
| Paraguay | PY | RUC | Tax/Vat | Tax Identifier (Registro Único de Contribuyentes) | | ||
| Peru | PE | CUI | Person | Person Identifier (Cédula Única de Identidad) | | ||
| Peru | PE | RUC | Tax/Vat | Tax Identifier (Registro Único de Contribuyentes) | | ||
| Russia | RU | INN | Tax/Vat | Tax Identifier (Идентификационный номер налогоплательщика) | | ||
| Spain | ES | CIF | Tax/Vat | Tax Identifier (Código de Identificación Fiscal) | | ||
| Spain | ES | DNI | Person | Identity code (Documento Nacional de Identidad) | | ||
| Spain | ES | NIE | Person | Identity code foreigner (Número de Identificación de Extranjero) | | ||
| Spain | ES | NIF | Tax | Tax Identifier (Número de Identificación Fiscal) | | ||
| Uruguay | UY | RUT | Tax/Vat | Tax Identifier (Registro Único Tributario) | | ||
| United States | US | EIN | Tax/Company | Tax Identifier (Employer Identification Number) | | ||
| United States | US | SSN | Tax/Individual | Tax Identifier (Social Security Number) | | ||
| Venezuelan | VE | RIF | Vat | Vat Identifier (Registro de Identificación Fiscal) | | ||
@@ -38,0 +56,0 @@ ### Examples |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
597748
227
7839
67
0