pseudonym-mcp 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pesel.d.ts","sourceRoot":"","sources":["../../../../src/patterns/locale/pl/pesel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"pesel.d.ts","sourceRoot":"","sources":["../../../../src/patterns/locale/pl/pesel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,eAAO,MAAM,SAAS,EAAE,WAWvB,CAAA"}
|
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates a Polish PESEL number using the official checksum algorithm.
|
|
3
|
-
* Weights: [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]
|
|
4
|
-
* Check digit = (10 - (weighted_sum % 10)) % 10
|
|
5
|
-
*/
|
|
6
|
-
function peselChecksum(input) {
|
|
7
|
-
const digits = input.replace(/\D/g, '');
|
|
8
|
-
if (digits.length !== 11)
|
|
9
|
-
return false;
|
|
10
|
-
const weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3];
|
|
11
|
-
const d = digits.split('').map(Number);
|
|
12
|
-
const sum = weights.reduce((acc, w, i) => acc + w * d[i], 0);
|
|
13
|
-
const check = (10 - (sum % 10)) % 10;
|
|
14
|
-
return check === d[10];
|
|
15
|
-
}
|
|
16
1
|
export const peselRule = {
|
|
17
2
|
id: 'pl.pesel',
|
|
18
3
|
entityType: 'PESEL',
|
|
19
|
-
// Matches
|
|
20
|
-
|
|
4
|
+
// Matches exactly 11 consecutive digits (word-bounded).
|
|
5
|
+
// Negative lookbehind for '+' prevents matching the digit portion of a
|
|
6
|
+
// compact international phone like "+48601234567" (which is 11 digits after '+').
|
|
7
|
+
// The label "PESEL" / "nr PESEL:" stays in the text — only the digits are replaced.
|
|
8
|
+
pattern: /(?<!\+)\b\d{11}\b/g,
|
|
21
9
|
locales: ['pl'],
|
|
22
10
|
engines: ['balanced', 'strict', 'paranoid'],
|
|
23
|
-
description: 'Polish national identification number (PESEL) — 11 digits
|
|
24
|
-
validate: peselChecksum,
|
|
11
|
+
description: 'Polish national identification number (PESEL) — exactly 11 consecutive digits',
|
|
25
12
|
};
|
|
26
13
|
//# sourceMappingURL=pesel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pesel.js","sourceRoot":"","sources":["../../../../src/patterns/locale/pl/pesel.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"pesel.js","sourceRoot":"","sources":["../../../../src/patterns/locale/pl/pesel.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAgB;IACpC,EAAE,EAAE,UAAU;IACd,UAAU,EAAE,OAAO;IACnB,wDAAwD;IACxD,uEAAuE;IACvE,kFAAkF;IAClF,oFAAoF;IACpF,OAAO,EAAE,oBAAoB;IAC7B,OAAO,EAAE,CAAC,IAAI,CAAC;IACf,OAAO,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;IAC3C,WAAW,EAAE,+EAA+E;CAC7F,CAAA"}
|
package/package.json
CHANGED