validate-polish
Advanced tools
Comparing version 1.1.0 to 1.1.1
export * from './lib'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -33,1 +33,2 @@ export declare const validatePolish: { | ||
}; | ||
export default validatePolish; |
@@ -10,20 +10,11 @@ "use strict"; | ||
pesel(pesel) { | ||
const reg = /^[0-9]{11}$/; | ||
if (reg.test(pesel) === false) { | ||
if (!/^[0-9]{11}$/.test(pesel)) { | ||
return false; | ||
} | ||
else { | ||
const dig = ('' + pesel).split(''); | ||
let control = (1 * parseInt(dig[0], 10) + 3 * parseInt(dig[1], 10) + 7 * parseInt(dig[2], 10) + 9 * parseInt(dig[3], 10) + 1 * parseInt(dig[4], 10) + 3 * parseInt(dig[5], 10) + 7 * parseInt(dig[6], 10) + 9 * parseInt(dig[7], 10) + 1 * parseInt(dig[8], 10) + 3 * parseInt(dig[9], 10)) % 10; | ||
if (control === 0) { | ||
control = 10; | ||
} | ||
control = 10 - control; | ||
if (parseInt(dig[10], 10) === control) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
const times = [1, 3, 7, 9]; | ||
const digits = `${pesel}`.split('').map(digit => parseInt(digit, 10)); | ||
const dig11 = digits.splice(-1)[0]; | ||
let control = digits | ||
.reduce((previousValue, currentValue, index) => previousValue + currentValue * times[index % 4]) % 10; | ||
return 10 - (control === 0 ? 10 : control) === dig11; | ||
}, | ||
@@ -148,3 +139,3 @@ /** | ||
}; | ||
module.exports = exports.validatePolish; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGliL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQWEsUUFBQSxjQUFjLEdBQUc7SUFDMUI7Ozs7T0FJRztJQUNILEtBQUssQ0FBQyxLQUFhO1FBQ2YsTUFBTSxHQUFHLEdBQUcsYUFBYSx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0FBRyxJQUFJLEdBQUcsQ0FBQyxNQUFNLEtBQUssRUFBRSxFQUFFO1lBQzNCLE9BQU8sS0FBSyxDQUFDO1NBQ2hCO1FBRUQsa0JBQWtCO1FBQ2xCLElBQUksR0FBRyxDQUFDLENBQUMsQ0FBQyxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsQ0FBQyxDQUFDLEtBQUssR0FBRyxFQUFFO1lBQ2xDLE9BQU8sS0FBSyxDQUFDO1NBQ2hCO1FBRUQsT0FBTyxJQUFJLENBQUMsWUFBWSxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsUUFBUSxFQUFFLEVBQUUsQ0FBQyxDQUFDLENBQUM7SUFDeEQsQ0FBQztDQUNKLENBQUM7QUFFRixrQkFBZSxzQkFBYyxDQUFDIn0= |
export * from './lib'; |
export * from './lib'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxPQUFPLENBQUMifQ== |
@@ -33,1 +33,2 @@ export declare const validatePolish: { | ||
}; | ||
export default validatePolish; |
@@ -8,20 +8,11 @@ export const validatePolish = { | ||
pesel(pesel) { | ||
const reg = /^[0-9]{11}$/; | ||
if (reg.test(pesel) === false) { | ||
if (!/^[0-9]{11}$/.test(pesel)) { | ||
return false; | ||
} | ||
else { | ||
const dig = ('' + pesel).split(''); | ||
let control = (1 * parseInt(dig[0], 10) + 3 * parseInt(dig[1], 10) + 7 * parseInt(dig[2], 10) + 9 * parseInt(dig[3], 10) + 1 * parseInt(dig[4], 10) + 3 * parseInt(dig[5], 10) + 7 * parseInt(dig[6], 10) + 9 * parseInt(dig[7], 10) + 1 * parseInt(dig[8], 10) + 3 * parseInt(dig[9], 10)) % 10; | ||
if (control === 0) { | ||
control = 10; | ||
} | ||
control = 10 - control; | ||
if (parseInt(dig[10], 10) === control) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
const times = [1, 3, 7, 9]; | ||
const digits = `${pesel}`.split('').map(digit => parseInt(digit, 10)); | ||
const dig11 = digits.splice(-1)[0]; | ||
let control = digits | ||
.reduce((previousValue, currentValue, index) => previousValue + currentValue * times[index % 4]) % 10; | ||
return 10 - (control === 0 ? 10 : control) === dig11; | ||
}, | ||
@@ -146,3 +137,3 @@ /** | ||
}; | ||
module.exports = validatePolish; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGliL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBQyxNQUFNLGNBQWMsR0FBRztJQUMxQjs7OztPQUlHO0lBQ0gsS0FBSyxDQUFDLEtBQWE7UUFDZixNQUFNLEdBQUcsR0FBRyxhQUFhLENBQUM7UUFDMUIsSUFBSSxHQUFHLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxLQUFLLEtBQUssRUFBRTtZQUMzQixPQUFPLEtBQUssQ0FBQztTQUNoQjthQUFNO1lBRUgsTUFBTSxHQUFHLEdBQUcsQ0FBQyxFQUFFLEdBQUcsS0FBSyxDQUFDLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQ25DLElBQUksT0FBTyxHQUFHLENBQUMsQ0FBQyxHQUFHLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDLEdBQUcsQ0FBQyxHQUFHLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDLEdBQUcsQ0FBQyxHQUFHLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQ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DQUFDLEdBQUcsY0FBYyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUMvQixDQUFDLEdBQUcsY0FBYyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUMvQixDQUFDLEdBQUcsY0FBYyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUMvQixDQUFDLEdBQUcsY0FBYyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBRXBDLEdBQUcsSUFBSSxFQUFFLENBQUM7UUFFVixJQUFJLEdBQUcsS0FBSyxjQUFjLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUU7WUFDckMsT0FBTyxLQUFLLENBQUM7U0FDaEI7UUFFRCxPQUFPLElBQUksQ0FBQztJQUNoQixDQUFDO0lBQ0Q7Ozs7T0FJRztJQUNILHlCQUF5QixDQUFDLEdBQVc7UUFDakMsZUFBZTtRQUNmLElBQUksQ0FBQyxHQUFHLElBQUksR0FBRyxDQUFDLE1BQU0sS0FBSyxFQUFFLEVBQUU7WUFDM0IsT0FBTyxLQUFLLENBQUM7U0FDaEI7UUFFRCxrQkFBa0I7UUFDbEIsSUFBSSxHQUFHLENBQUMsQ0FBQyxDQUFDLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLEVBQUU7WUFDbEMsT0FBTyxLQUFLLENBQUM7U0FDaEI7UUFFRCxPQUFPLElBQUksQ0FBQyxZQUFZLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxRQUFRLEVBQUUsRUFBRSxDQUFDLENBQUMsQ0FBQztJQUN4RCxDQUFDO0NBQ0osQ0FBQztBQUVGLGVBQWUsY0FBYyxDQUFDIn0= |
{ | ||
"name": "validate-polish", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Utility library for validation of PESEL, NIP, REGON, identity card etc. Aimed at mostly at Polish enviroment. [Polish] Walidacja numerów pesel, nip, regon, dowodu osobistego.", | ||
@@ -5,0 +5,0 @@ "main": "build/main/index.js", |
@@ -37,3 +37,3 @@ <p align="center"> | ||
```ts | ||
import validatePolish from 'validate-polish'; | ||
import { validatePolish } from 'validate-polish'; | ||
@@ -49,8 +49,8 @@ if (!validatePolish.pesel(`92060512181`)) { | ||
if (!validatePolish.regon(`1251677`)) { | ||
throw new Error('Invalid regon.'); | ||
throw new Error(`Invalid regon.`); | ||
} | ||
if (!validatePolish.identityCard(identityCard)) { | ||
throw new Error(`Invalid nip.`); | ||
if (!validatePolish.identityCard(`14124142`)) { | ||
throw new Error(`Invalid identity card.`); | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
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
0
33368
349