myanmar-nrc-validator 0.0.0-stage → 1.0.0

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.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * မြန်မာ NRC နံပါတ် မှန်/မမှန် စစ်ဆေးပေးသော Function
3
+ * ဥပမာ - "12/ဥကမ(နိုင်)123456" သို့မဟုတ် "12/Oukama(N)123456"
4
+ */
5
+ export declare function validateNRC(nrcString: string): boolean;
6
+ /**
7
+ * NRC နံပါတ်ကို အပိုင်းလိုက် ခွဲထုတ်လိုပါက အသုံးပြုနိုင်သော Helper Function
8
+ */
9
+ export declare function parseNRC(nrcString: string): {
10
+ stateCode: string | undefined;
11
+ township: string | undefined;
12
+ type: string | undefined;
13
+ number: string | undefined;
14
+ } | null;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CActD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM;;;;;SAczC"}
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * မြန်မာ NRC နံပါတ် မှန်/မမှန် စစ်ဆေးပေးသော Function
3
+ * ဥပမာ - "12/ဥကမ(နိုင်)123456" သို့မဟုတ် "12/Oukama(N)123456"
4
+ */
5
+ export function validateNRC(nrcString) {
6
+ if (!nrcString || typeof nrcString !== "string") {
7
+ return false;
8
+ }
9
+ // Space များကို ဖယ်ရှားခြင်း
10
+ const cleaned = nrcString.trim();
11
+ // မြန်မာ NRC Regex Pattern (State/Region + Township + (N/Naing/နိုင်) + 6 digits)
12
+ // ဥပမာ - ၁၂/ဥကမ(နိုင်)၁၂၃၄၅၆ သို့မဟုတ် 12/Oukama(N)123456
13
+ const nrcPattern = /^[0-9]{1,2}\/[А-Яa-z\u1000-\u109F]+(\(N\)|\(Naing\)|\(နိုင်\)|\(NAING\))[0-9]{6}$/i;
14
+ return nrcPattern.test(cleaned);
15
+ }
16
+ /**
17
+ * NRC နံပါတ်ကို အပိုင်းလိုက် ခွဲထုတ်လိုပါက အသုံးပြုနိုင်သော Helper Function
18
+ */
19
+ export function parseNRC(nrcString) {
20
+ if (!validateNRC(nrcString)) {
21
+ return null;
22
+ }
23
+ const cleaned = nrcString.trim();
24
+ const parts = cleaned.split(/\/|\(|\)/);
25
+ return {
26
+ stateCode: parts[0],
27
+ township: parts[1],
28
+ type: parts[2],
29
+ number: parts[3],
30
+ };
31
+ }
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB;IAC3C,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6BAA6B;IAC7B,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAEjC,kFAAkF;IAClF,0DAA0D;IAC1D,MAAM,UAAU,GACd,oFAAoF,CAAC;IAEvF,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAiB;IACxC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAExC,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAClB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;KACjB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "myanmar-nrc-validator",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "A simple npm package to validate Myanmar NRC numbers",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "prepublishOnly": "npm run build",
19
+ "test": "echo \"Error: no test specified\" && exit 1"
20
+ },
21
+ "keywords": [
22
+ "myanmar",
23
+ "nrc",
24
+ "validator"
25
+ ],
26
+ "author": "Aung Phyo Khant",
27
+ "license": "MIT",
28
+ "type": "module",
29
+ "devDependencies": {
30
+ "@types/node": "^26.6.4",
31
+ "rimraf": "^6.1.3",
32
+ "typescript": "^7.0.2"
33
+ }
34
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.