@alwatr/iranian-national-code-validator 1.0.6 โ 1.0.8
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 +15 -0
- package/dist/main.cjs +2 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +2 -1
- package/dist/main.mjs.map +1 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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.8](https://github.com/Alwatr/nanolib/compare/@alwatr/iranian-national-code-validator@1.0.7...@alwatr/iranian-national-code-validator@1.0.8) (2025-09-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alwatr/iranian-national-code-validator
|
|
9
|
+
|
|
10
|
+
## [1.0.7](https://github.com/Alwatr/nanolib/compare/@alwatr/iranian-national-code-validator@1.0.6...@alwatr/iranian-national-code-validator@1.0.7) (2025-09-20)
|
|
11
|
+
|
|
12
|
+
### ๐ Bug Fixes
|
|
13
|
+
|
|
14
|
+
* add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
|
|
15
|
+
* add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
|
|
16
|
+
|
|
17
|
+
### ๐งน Miscellaneous Chores
|
|
18
|
+
|
|
19
|
+
* remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
|
|
20
|
+
|
|
6
21
|
## [1.0.6](https://github.com/Alwatr/nanolib/compare/@alwatr/iranian-national-code-validator@1.0.5...@alwatr/iranian-national-code-validator@1.0.6) (2025-09-19)
|
|
7
22
|
|
|
8
23
|
**Note:** Version bump only for package @alwatr/iranian-national-code-validator
|
package/dist/main.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/** ๐ฆ @alwatr/iranian-national-code-validator v1.0.8 */
|
|
2
|
+
__dev_mode__: console.debug("๐ฆ @alwatr/iranian-national-code-validator v1.0.8");
|
|
2
3
|
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{isValidIranianNationalCode:()=>isValidIranianNationalCode});module.exports=__toCommonJS(main_exports);function isValidIranianNationalCode(str){if(!/^\d{10}$/.test(str))return false;const check=+str[9];const sum=str.split("").slice(0,9).reduce((acc,x,i)=>acc+ +x*(10-i),0)%11;return sum<2?check===sum:check+sum===11}0&&(module.exports={isValidIranianNationalCode});
|
|
3
4
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.cjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
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": "
|
|
5
|
+
"mappings": ";;qqBAAA,iJAmBO,SAAS,2BAA2B,IAAsB,CAC/D,GAAI,CAAC,WAAW,KAAK,GAAG,EAAG,MAAO,OAElC,MAAM,MAAQ,CAAC,IAAI,CAAC,EACpB,MAAM,IAAM,IAAI,MAAM,EAAE,EAAE,MAAM,EAAG,CAAC,EAAE,OAAO,CAAC,IAAK,EAAG,IAAM,KAAM,CAAC,GAAK,GAAK,GAAI,CAAC,EAAI,GAEtF,OAAO,IAAM,EAAI,QAAU,IAAM,MAAQ,MAAQ,EACnD",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/** ๐ฆ @alwatr/iranian-national-code-validator v1.0.8 */
|
|
2
|
+
__dev_mode__: console.debug("๐ฆ @alwatr/iranian-national-code-validator v1.0.8");
|
|
2
3
|
function isValidIranianNationalCode(str){if(!/^\d{10}$/.test(str))return false;const check=+str[9];const sum=str.split("").slice(0,9).reduce((acc,x,i)=>acc+ +x*(10-i),0)%11;return sum<2?check===sum:check+sum===11}export{isValidIranianNationalCode};
|
|
3
4
|
//# sourceMappingURL=main.mjs.map
|
package/dist/main.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
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": "
|
|
5
|
+
"mappings": ";;AAmBO,SAAS,2BAA2B,IAAsB,CAC/D,GAAI,CAAC,WAAW,KAAK,GAAG,EAAG,MAAO,OAElC,MAAM,MAAQ,CAAC,IAAI,CAAC,EACpB,MAAM,IAAM,IAAI,MAAM,EAAE,EAAE,MAAM,EAAG,CAAC,EAAE,OAAO,CAAC,IAAK,EAAG,IAAM,KAAM,CAAC,GAAK,GAAK,GAAI,CAAC,EAAI,GAEtF,OAAO,IAAM,EAAI,QAAU,IAAM,MAAQ,MAAQ,EACnD",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +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.8",
|
|
5
5
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/Alwatr/nanolib/issues",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@alwatr/nano-build": "6.
|
|
9
|
-
"@alwatr/prettier-config": "5.0.
|
|
10
|
-
"@alwatr/tsconfig-base": "6.0.
|
|
11
|
-
"@alwatr/type-helper": "6.1.
|
|
8
|
+
"@alwatr/nano-build": "6.3.1",
|
|
9
|
+
"@alwatr/prettier-config": "5.0.4",
|
|
10
|
+
"@alwatr/tsconfig-base": "6.0.2",
|
|
11
|
+
"@alwatr/type-helper": "6.1.1",
|
|
12
12
|
"typescript": "^5.9.2"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"watch:es": "yarn run build:es --watch",
|
|
70
70
|
"watch:ts": "yarn run build:ts --watch --preserveWatchOutput"
|
|
71
71
|
},
|
|
72
|
+
"sideEffects": false,
|
|
72
73
|
"type": "module",
|
|
73
74
|
"types": "./dist/main.d.ts",
|
|
74
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "912cbccc4aae450a2cd2bbb401b898e00af05386"
|
|
75
76
|
}
|