is-valid-pesel
Advanced tools
Comparing version 1.2.0 to 1.2.1
"use strict"; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]; | ||
@@ -16,10 +16,9 @@ function isValidPESEL(rawPesel) { | ||
var sum = 0; | ||
for (var position = 0; position < weights.length; position += 1) { | ||
var weight = weights[position]; | ||
var digit = parseInt(pesel[position], 10); | ||
weights.forEach(function (weight, position) { | ||
var digit = Number(pesel[position]); | ||
sum += weight * digit; | ||
} | ||
}); | ||
var checksum = (10 - (sum % 10)) % 10; | ||
return checksum === parseInt(pesel[10], 10); | ||
return checksum === Number(pesel[10]); | ||
} | ||
exports["default"] = isValidPESEL; | ||
exports.default = isValidPESEL; |
@@ -14,9 +14,8 @@ var weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]; | ||
var sum = 0; | ||
for (var position = 0; position < weights.length; position += 1) { | ||
var weight = weights[position]; | ||
var digit = parseInt(pesel[position], 10); | ||
weights.forEach(function (weight, position) { | ||
var digit = Number(pesel[position]); | ||
sum += weight * digit; | ||
} | ||
}); | ||
var checksum = (10 - (sum % 10)) % 10; | ||
return checksum === parseInt(pesel[10], 10); | ||
return checksum === Number(pesel[10]); | ||
} |
{ | ||
"name": "is-valid-pesel", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Check if a number is a valid PESEL", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -18,11 +18,10 @@ const weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]; | ||
let sum = 0; | ||
for (let position = 0; position < weights.length; position += 1) { | ||
const weight = weights[position]; | ||
const digit = parseInt(pesel[position], 10); | ||
weights.forEach((weight, position) => { | ||
const digit = Number(pesel[position]); | ||
sum += weight * digit; | ||
} | ||
}); | ||
const checksum = (10 - (sum % 10)) % 10; | ||
return checksum === parseInt(pesel[10], 10); | ||
return checksum === Number(pesel[10]); | ||
} |
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
0
7350
101