validate-polish
Advanced tools
Comparing version 2.0.32 to 2.0.33
@@ -15,2 +15,2 @@ var validatePolish=function(r){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var t={checksum:function(r,t){for(var e=r.length-1,n=0,u=0;u<e;++u){n+=parseInt(r[u],10)*t[u]}var i=n%11;return(10===i?0:i)===parseInt(r.slice(-1),10)},pesel:function(r){if(!/^[0-9]{11}$/u.test(r))return!1;var t=[1,3,7,9],e=(""+r).split("").map((function(r){return parseInt(r,10)})),n=function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,u,i=e.call(r),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(r){u={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(u)throw u.error}}return a}(e.splice(-1),1)[0],u=e.reduce((function(r,e,n){return r+e*t[n%4]}))%10;return 10-(0===u?10:u)===n},nip:function(r){if("string"!=typeof r)return!1;var t=r.replace(/-/gu,"");if(!/^[0-9]{10}$/u.test(t))return!1;var e=String(t).split(""),n=[6,5,7,2,3,4,5,6,7].map((function(r,t){return r*parseInt(e[t],10)})),u=0;n.forEach((function(r){u+=r}));var i=u%11;return parseInt(e[9],10)===i},regon:function(r){if(!/^[0-9]{9,14}$/u.test(r))return!1;var e=[8,9,2,3,4,5,6,7];if(9===r.length)return t.checksum(r,e);return t.checksum(r.slice(0,9),e)&&t.checksum(r,[2,4,8,5,0,9,7,3,6,1,2,4,8])},identityCard:function(r){if(!r||9!==r.length)return!1;for(var t=r.toUpperCase(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=function(r){for(var t=0,n=e.length;t<n;t++)if(r===e[t])return t;return-1},u=0;u<3;++u)if(n(t[u])<10)return!1;for(u=3;u<9;++u)if(n(t[u])<0||n(t[u])>9)return!1;var i=7*n(t[0])+3*n(t[1])+Number(n(t[2]))+7*n(t[4])+3*n(t[5])+Number(n(t[6]))+7*n(t[7])+3*n(t[8]);return(i%=10)===n(t[3])},identityCardWithSeparator:function(r){return!(!r||10!==r.length)&&((" "===r[3]||"-"===r[3])&&this.identityCard(r.replace(/[\s-]/gu,"")))}};return r.validatePolish=t,Object.defineProperty(r,"__esModule",{value:!0}),r}({}); | ||
***************************************************************************** */var t={checksum:function(r,t){for(var e=r.length-1,n=0,u=0;u<e;++u){n+=parseInt(r[u],10)*t[u]}var i=n%11;return(10===i?0:i)===parseInt(r.slice(-1),10)},pesel:function(r){var t=Number(r.substring(2,4));if(!t||t<1||t>12)return console.log(r),!1;var e=Number(r.substring(4,6));if(!e||e<1||e>31)return!1;if(!/^[0-9]{11}$/u.test(r))return!1;var n=[1,3,7,9],u=(""+r).split("").map((function(r){return parseInt(r,10)})),i=function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,u,i=e.call(r),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(r){u={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(u)throw u.error}}return a}(u.splice(-1),1)[0],a=u.reduce((function(r,t,e){return r+t*n[e%4]}))%10;return 10-(0===a?10:a)===i},nip:function(r){if("string"!=typeof r)return!1;var t=r.replace(/-/gu,"");if(!/^[0-9]{10}$/u.test(t))return!1;var e=String(t).split(""),n=[6,5,7,2,3,4,5,6,7].map((function(r,t){return r*parseInt(e[t],10)})),u=0;n.forEach((function(r){u+=r}));var i=u%11;return parseInt(e[9],10)===i},regon:function(r){if(!/^[0-9]{9,14}$/u.test(r))return!1;var e=[8,9,2,3,4,5,6,7];if(9===r.length)return t.checksum(r,e);return t.checksum(r.slice(0,9),e)&&t.checksum(r,[2,4,8,5,0,9,7,3,6,1,2,4,8])},identityCard:function(r){if(!r||9!==r.length)return!1;for(var t=r.toUpperCase(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=function(r){for(var t=0,n=e.length;t<n;t++)if(r===e[t])return t;return-1},u=0;u<3;++u)if(n(t[u])<10)return!1;for(u=3;u<9;++u)if(n(t[u])<0||n(t[u])>9)return!1;var i=7*n(t[0])+3*n(t[1])+Number(n(t[2]))+7*n(t[4])+3*n(t[5])+Number(n(t[6]))+7*n(t[7])+3*n(t[8]);return(i%=10)===n(t[3])},identityCardWithSeparator:function(r){return!(!r||10!==r.length)&&((" "===r[3]||"-"===r[3])&&this.identityCard(r.replace(/[\s-]/gu,"")))}};return r.validatePolish=t,Object.defineProperty(r,"__esModule",{value:!0}),r}({}); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r={checksum:function(r,t){for(var e=r.length-1,n=0,u=0;u<e;++u){n+=parseInt(r[u],10)*t[u]}var i=n%11;return(10===i?0:i)===parseInt(r.slice(-1),10)},pesel:function(r){if(!/^[0-9]{11}$/u.test(r))return!1;var t=[1,3,7,9],e=(""+r).split("").map((function(r){return parseInt(r,10)})),n= | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r={checksum:function(r,t){for(var e=r.length-1,n=0,u=0;u<e;++u){n+=parseInt(r[u],10)*t[u]}var i=n%11;return(10===i?0:i)===parseInt(r.slice(-1),10)},pesel:function(r){var t=Number(r.substring(2,4));if(!t||t<1||t>12)return console.log(r),!1;var e=Number(r.substring(4,6));if(!e||e<1||e>31)return!1;if(!/^[0-9]{11}$/u.test(r))return!1;var n=[1,3,7,9],u=(""+r).split("").map((function(r){return parseInt(r,10)})),i= | ||
/*! ***************************************************************************** | ||
@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,u,i=e.call(r),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(r){u={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(u)throw u.error}}return a}(e.splice(-1),1)[0],u=e.reduce((function(r,e,n){return r+e*t[n%4]}))%10;return 10-(0===u?10:u)===n},nip:function(r){if("string"!=typeof r)return!1;var t=r.replace(/-/gu,"");if(!/^[0-9]{10}$/u.test(t))return!1;var e=String(t).split(""),n=[6,5,7,2,3,4,5,6,7].map((function(r,t){return r*parseInt(e[t],10)})),u=0;n.forEach((function(r){u+=r}));var i=u%11;return parseInt(e[9],10)===i},regon:function(t){if(!/^[0-9]{9,14}$/u.test(t))return!1;var e=[8,9,2,3,4,5,6,7];if(9===t.length)return r.checksum(t,e);return r.checksum(t.slice(0,9),e)&&r.checksum(t,[2,4,8,5,0,9,7,3,6,1,2,4,8])},identityCard:function(r){if(!r||9!==r.length)return!1;for(var t=r.toUpperCase(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=function(r){for(var t=0,n=e.length;t<n;t++)if(r===e[t])return t;return-1},u=0;u<3;++u)if(n(t[u])<10)return!1;for(u=3;u<9;++u)if(n(t[u])<0||n(t[u])>9)return!1;var i=7*n(t[0])+3*n(t[1])+Number(n(t[2]))+7*n(t[4])+3*n(t[5])+Number(n(t[6]))+7*n(t[7])+3*n(t[8]);return(i%=10)===n(t[3])},identityCardWithSeparator:function(r){return!(!r||10!==r.length)&&((" "===r[3]||"-"===r[3])&&this.identityCard(r.replace(/[\s-]/gu,"")))}};exports.validatePolish=r; | ||
function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,u,i=e.call(r),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(r){u={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(u)throw u.error}}return a}(u.splice(-1),1)[0],a=u.reduce((function(r,t,e){return r+t*n[e%4]}))%10;return 10-(0===a?10:a)===i},nip:function(r){if("string"!=typeof r)return!1;var t=r.replace(/-/gu,"");if(!/^[0-9]{10}$/u.test(t))return!1;var e=String(t).split(""),n=[6,5,7,2,3,4,5,6,7].map((function(r,t){return r*parseInt(e[t],10)})),u=0;n.forEach((function(r){u+=r}));var i=u%11;return parseInt(e[9],10)===i},regon:function(t){if(!/^[0-9]{9,14}$/u.test(t))return!1;var e=[8,9,2,3,4,5,6,7];if(9===t.length)return r.checksum(t,e);return r.checksum(t.slice(0,9),e)&&r.checksum(t,[2,4,8,5,0,9,7,3,6,1,2,4,8])},identityCard:function(r){if(!r||9!==r.length)return!1;for(var t=r.toUpperCase(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=function(r){for(var t=0,n=e.length;t<n;t++)if(r===e[t])return t;return-1},u=0;u<3;++u)if(n(t[u])<10)return!1;for(u=3;u<9;++u)if(n(t[u])<0||n(t[u])>9)return!1;var i=7*n(t[0])+3*n(t[1])+Number(n(t[2]))+7*n(t[4])+3*n(t[5])+Number(n(t[6]))+7*n(t[7])+3*n(t[8]);return(i%=10)===n(t[3])},identityCardWithSeparator:function(r){return!(!r||10!==r.length)&&((" "===r[3]||"-"===r[3])&&this.identityCard(r.replace(/[\s-]/gu,"")))}};exports.validatePolish=r; |
@@ -15,2 +15,2 @@ /*! ***************************************************************************** | ||
***************************************************************************** */ | ||
var r={checksum:function(r,t){for(var n=r.length-1,e=0,u=0;u<n;++u){e+=parseInt(r[u],10)*t[u]}var i=e%11;return(10===i?0:i)===parseInt(r.slice(-1),10)},pesel:function(r){if(!/^[0-9]{11}$/u.test(r))return!1;var t=[1,3,7,9],n=(""+r).split("").map((function(r){return parseInt(r,10)})),e=function(r,t){var n="function"==typeof Symbol&&r[Symbol.iterator];if(!n)return r;var e,u,i=n.call(r),a=[];try{for(;(void 0===t||t-- >0)&&!(e=i.next()).done;)a.push(e.value)}catch(r){u={error:r}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(u)throw u.error}}return a}(n.splice(-1),1)[0],u=n.reduce((function(r,n,e){return r+n*t[e%4]}))%10;return 10-(0===u?10:u)===e},nip:function(r){if("string"!=typeof r)return!1;var t=r.replace(/-/gu,"");if(!/^[0-9]{10}$/u.test(t))return!1;var n=String(t).split(""),e=[6,5,7,2,3,4,5,6,7].map((function(r,t){return r*parseInt(n[t],10)})),u=0;e.forEach((function(r){u+=r}));var i=u%11;return parseInt(n[9],10)===i},regon:function(t){if(!/^[0-9]{9,14}$/u.test(t))return!1;var n=[8,9,2,3,4,5,6,7];if(9===t.length)return r.checksum(t,n);return r.checksum(t.slice(0,9),n)&&r.checksum(t,[2,4,8,5,0,9,7,3,6,1,2,4,8])},identityCard:function(r){if(!r||9!==r.length)return!1;for(var t=r.toUpperCase(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],e=function(r){for(var t=0,e=n.length;t<e;t++)if(r===n[t])return t;return-1},u=0;u<3;++u)if(e(t[u])<10)return!1;for(u=3;u<9;++u)if(e(t[u])<0||e(t[u])>9)return!1;var i=7*e(t[0])+3*e(t[1])+Number(e(t[2]))+7*e(t[4])+3*e(t[5])+Number(e(t[6]))+7*e(t[7])+3*e(t[8]);return(i%=10)===e(t[3])},identityCardWithSeparator:function(r){return!(!r||10!==r.length)&&((" "===r[3]||"-"===r[3])&&this.identityCard(r.replace(/[\s-]/gu,"")))}};export{r as validatePolish}; | ||
var r={checksum:function(r,t){for(var n=r.length-1,e=0,u=0;u<n;++u){e+=parseInt(r[u],10)*t[u]}var i=e%11;return(10===i?0:i)===parseInt(r.slice(-1),10)},pesel:function(r){var t=Number(r.substring(2,4));if(!t||t<1||t>12)return console.log(r),!1;var n=Number(r.substring(4,6));if(!n||n<1||n>31)return!1;if(!/^[0-9]{11}$/u.test(r))return!1;var e=[1,3,7,9],u=(""+r).split("").map((function(r){return parseInt(r,10)})),i=function(r,t){var n="function"==typeof Symbol&&r[Symbol.iterator];if(!n)return r;var e,u,i=n.call(r),a=[];try{for(;(void 0===t||t-- >0)&&!(e=i.next()).done;)a.push(e.value)}catch(r){u={error:r}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(u)throw u.error}}return a}(u.splice(-1),1)[0],a=u.reduce((function(r,t,n){return r+t*e[n%4]}))%10;return 10-(0===a?10:a)===i},nip:function(r){if("string"!=typeof r)return!1;var t=r.replace(/-/gu,"");if(!/^[0-9]{10}$/u.test(t))return!1;var n=String(t).split(""),e=[6,5,7,2,3,4,5,6,7].map((function(r,t){return r*parseInt(n[t],10)})),u=0;e.forEach((function(r){u+=r}));var i=u%11;return parseInt(n[9],10)===i},regon:function(t){if(!/^[0-9]{9,14}$/u.test(t))return!1;var n=[8,9,2,3,4,5,6,7];if(9===t.length)return r.checksum(t,n);return r.checksum(t.slice(0,9),n)&&r.checksum(t,[2,4,8,5,0,9,7,3,6,1,2,4,8])},identityCard:function(r){if(!r||9!==r.length)return!1;for(var t=r.toUpperCase(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],e=function(r){for(var t=0,e=n.length;t<e;t++)if(r===n[t])return t;return-1},u=0;u<3;++u)if(e(t[u])<10)return!1;for(u=3;u<9;++u)if(e(t[u])<0||e(t[u])>9)return!1;var i=7*e(t[0])+3*e(t[1])+Number(e(t[2]))+7*e(t[4])+3*e(t[5])+Number(e(t[6]))+7*e(t[7])+3*e(t[8]);return(i%=10)===e(t[3])},identityCardWithSeparator:function(r){return!(!r||10!==r.length)&&((" "===r[3]||"-"===r[3])&&this.identityCard(r.replace(/[\s-]/gu,"")))}};export{r as validatePolish}; |
{ | ||
"name": "validate-polish", | ||
"version": "2.0.32", | ||
"version": "2.0.33", | ||
"description": "Utility library for validation of PESEL, NIP, REGON, identity card etc. Aimed mostly at Polish enviroment. [Polish] Walidacja numerów pesel, nip, regon, dowodu osobistego.", | ||
@@ -37,3 +37,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "7c31f6df779282de7244b9954aa50eaaca5425fd" | ||
"gitHead": "7a89f0825b8be9461235ad15590bef7b1235663f" | ||
} |
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
84
12762
7