@alwatr/iranian-national-code-validator 1.0.2 → 1.0.4
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.
- package/CHANGELOG.md +10 -0
- package/dist/main.cjs +1 -3
- package/dist/main.cjs.map +2 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.mjs +1 -3
- package/dist/main.mjs.map +2 -2
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/iranian-national-code-validator@1.0.3...@alwatr/iranian-national-code-validator@1.0.4) (2025-09-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alwatr/iranian-national-code-validator
|
|
9
|
+
|
|
10
|
+
## [1.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/iranian-national-code-validator@1.0.2...@alwatr/iranian-national-code-validator@1.0.3) (2025-09-13)
|
|
11
|
+
|
|
12
|
+
### 🧹 Miscellaneous Chores
|
|
13
|
+
|
|
14
|
+
* remove package-tracer dependency and related code from fetch package ([96fe4e9](https://github.com/Alwatr/nanolib/commit/96fe4e9552a205f218ceed187c55e4e904a07089))
|
|
15
|
+
|
|
6
16
|
## [1.0.2](https://github.com/Alwatr/nanolib/compare/@alwatr/iranian-national-code-validator@1.0.1...@alwatr/iranian-national-code-validator@1.0.2) (2025-09-09)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @alwatr/iranian-national-code-validator
|
package/dist/main.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @alwatr/iranian-national-code-validator v1.0.
|
|
1
|
+
/* @alwatr/iranian-national-code-validator v1.0.4 */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -24,8 +24,6 @@ __export(main_exports, {
|
|
|
24
24
|
isValidIranianNationalCode: () => isValidIranianNationalCode
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(main_exports);
|
|
27
|
-
var import_package_tracer = require("@alwatr/package-tracer");
|
|
28
|
-
__dev_mode__: import_package_tracer.packageTracer.add("@alwatr/iranian-national-code-validator", "1.0.2");
|
|
29
27
|
function isValidIranianNationalCode(str) {
|
|
30
28
|
if (!/^\d{10}$/.test(str)) return false;
|
|
31
29
|
const check = +str[9];
|
package/dist/main.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * Validates an Iranian National Code (Code Melli).\n *\n * The validation is based on the official algorithm:\n * 1. The code must be 10 digits.\n * 2. The last digit is a check digit.\n * 3. A weighted sum of the first 9 digits is calculated.\n * 4. The remainder of the sum divided by 11 is compared with the check digit based on a specific rule.\n *\n * @param str The Iranian National Code to validate.\n * @returns `true` if the national code is valid, `false` otherwise.\n *\n * @example\n * ```ts\n * console.log(isValidIranianNationalCode('0018550152')); // true\n * console.log(isValidIranianNationalCode('0018550153')); // false\n * console.log(isValidIranianNationalCode('12345')); // false\n * ```\n */\nexport function isValidIranianNationalCode(str: string): boolean {\n if (!/^\\d{10}$/.test(str)) return false;\n\n const check = +str[9];\n const sum = str.split('').slice(0, 9).reduce((acc, x, i) => acc + +x * (10 - i), 0) % 11;\n\n return sum < 2 ? check === sum : check + sum === 11;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,2BAA2B,KAAsB;AAC/D,MAAI,CAAC,WAAW,KAAK,GAAG,EAAG,QAAO;AAElC,QAAM,QAAQ,CAAC,IAAI,CAAC;AACpB,QAAM,MAAM,IAAI,MAAM,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI;AAEtF,SAAO,MAAM,IAAI,UAAU,MAAM,QAAQ,QAAQ;AACnD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO/D"}
|
package/dist/main.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
/* @alwatr/iranian-national-code-validator v1.0.
|
|
1
|
+
/* @alwatr/iranian-national-code-validator v1.0.4 */
|
|
2
2
|
|
|
3
3
|
// src/main.ts
|
|
4
|
-
import { packageTracer } from "@alwatr/package-tracer";
|
|
5
|
-
__dev_mode__: packageTracer.add("@alwatr/iranian-national-code-validator", "1.0.2");
|
|
6
4
|
function isValidIranianNationalCode(str) {
|
|
7
5
|
if (!/^\d{10}$/.test(str)) return false;
|
|
8
6
|
const check = +str[9];
|
package/dist/main.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;
|
|
4
|
+
"sourcesContent": ["/**\n * Validates an Iranian National Code (Code Melli).\n *\n * The validation is based on the official algorithm:\n * 1. The code must be 10 digits.\n * 2. The last digit is a check digit.\n * 3. A weighted sum of the first 9 digits is calculated.\n * 4. The remainder of the sum divided by 11 is compared with the check digit based on a specific rule.\n *\n * @param str The Iranian National Code to validate.\n * @returns `true` if the national code is valid, `false` otherwise.\n *\n * @example\n * ```ts\n * console.log(isValidIranianNationalCode('0018550152')); // true\n * console.log(isValidIranianNationalCode('0018550153')); // false\n * console.log(isValidIranianNationalCode('12345')); // false\n * ```\n */\nexport function isValidIranianNationalCode(str: string): boolean {\n if (!/^\\d{10}$/.test(str)) return false;\n\n const check = +str[9];\n const sum = str.split('').slice(0, 9).reduce((acc, x, i) => acc + +x * (10 - i), 0) % 11;\n\n return sum < 2 ? check === sum : check + sum === 11;\n}\n"],
|
|
5
|
+
"mappings": ";;;AAmBO,SAAS,2BAA2B,KAAsB;AAC/D,MAAI,CAAC,WAAW,KAAK,GAAG,EAAG,QAAO;AAElC,QAAM,QAAQ,CAAC,IAAI,CAAC;AACpB,QAAM,MAAM,IAAI,MAAM,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI;AAEtF,SAAO,MAAM,IAAI,UAAU,MAAM,QAAQ,QAAQ;AACnD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/iranian-national-code-validator",
|
|
3
3
|
"description": "A tiny TypeScript library to Validates an Iranian National Code (Code Melli).",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/Alwatr/nanolib/issues",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"@alwatr/package-tracer": "5.5.10"
|
|
9
|
-
},
|
|
10
7
|
"devDependencies": {
|
|
11
|
-
"@alwatr/nano-build": "6.1.
|
|
8
|
+
"@alwatr/nano-build": "6.1.2",
|
|
12
9
|
"@alwatr/prettier-config": "5.0.3",
|
|
13
10
|
"@alwatr/tsconfig-base": "6.0.1",
|
|
14
|
-
"@alwatr/type-helper": "6.0.
|
|
11
|
+
"@alwatr/type-helper": "6.0.2",
|
|
15
12
|
"typescript": "^5.9.2"
|
|
16
13
|
},
|
|
17
14
|
"exports": {
|
|
@@ -74,5 +71,5 @@
|
|
|
74
71
|
},
|
|
75
72
|
"type": "module",
|
|
76
73
|
"types": "./dist/main.d.ts",
|
|
77
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "4da18811162df49c118acd71086cdbe38b27f250"
|
|
78
75
|
}
|