kcommons 13.12.2 → 13.12.3

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,2 +1,15 @@
1
1
  export declare const CIN_REGEX: RegExp;
2
+ /**
3
+ * Returns boolean based on whether the provided CIN is valid or not.
4
+ * * @param cin_no CIN no. to be validated
5
+ * @returns Boolean
6
+ *
7
+ * Validation Rules:
8
+ * 1. ^[LU] → First character is L (listed) or U (unlisted)
9
+ * 2. [0-9]{5} → Next 5 digits = industry code
10
+ * 3. [A-Z]{2} → Next 2 letters = state code (e.g. MH, DL, KA)
11
+ * 4. [0-9]{4} → Next 4 digits = year of incorporation
12
+ * 5. [A-Z]{3} → Next 3 letters = company type (e.g. PTC, PLC, FTC, GOI etc.)
13
+ * 6. [0-9]{6}$ → Last 6 digits = registration number
14
+ */
2
15
  export declare function isValidCIN(cin_no: string): boolean;
@@ -2,9 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CIN_REGEX = void 0;
4
4
  exports.isValidCIN = isValidCIN;
5
- exports.CIN_REGEX = /^[LU][A-Z]{5}\d{5}[A-Z]{2}[A-Z]\d{6}$/;
5
+ exports.CIN_REGEX = /^[LU][0-9]{5}[A-Z]{2}[0-9]{4}[A-Z]{3}[0-9]{6}$/;
6
+ /**
7
+ * Returns boolean based on whether the provided CIN is valid or not.
8
+ * * @param cin_no CIN no. to be validated
9
+ * @returns Boolean
10
+ *
11
+ * Validation Rules:
12
+ * 1. ^[LU] → First character is L (listed) or U (unlisted)
13
+ * 2. [0-9]{5} → Next 5 digits = industry code
14
+ * 3. [A-Z]{2} → Next 2 letters = state code (e.g. MH, DL, KA)
15
+ * 4. [0-9]{4} → Next 4 digits = year of incorporation
16
+ * 5. [A-Z]{3} → Next 3 letters = company type (e.g. PTC, PLC, FTC, GOI etc.)
17
+ * 6. [0-9]{6}$ → Last 6 digits = registration number
18
+ */
6
19
  function isValidCIN(cin_no) {
7
- // TODO: Fix the CIN_REGEX value and use it to verify if the provided cin_no is valid or invalid
8
- return true;
9
- // return CIN_REGEX.test(cin_no);
20
+ return exports.CIN_REGEX.test(cin_no);
10
21
  }
@@ -0,0 +1,13 @@
1
+ export declare const UDYAM_REGEX: RegExp;
2
+ /**
3
+ * Returns boolean based on whether the provided UDYAM is valid or not.
4
+ * * @param udyam_no UDYAM no. to be validated
5
+ * @returns Boolean
6
+ *
7
+ * Validation Rules:
8
+ * 1. UDYAM- → fixed prefix
9
+ * 2. [A-Z]{2} → valid 2-letter state code
10
+ * 3. \d{2} → 2 digits for district code
11
+ * 4. \d{7} → 7-digit unique number
12
+ */
13
+ export declare function isValidUdyam(udyam_no: string): boolean;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UDYAM_REGEX = void 0;
4
+ exports.isValidUdyam = isValidUdyam;
5
+ exports.UDYAM_REGEX = /^UDYAM-[A-Z]{2}-\d{2}-\d{7}$/;
6
+ /**
7
+ * Returns boolean based on whether the provided UDYAM is valid or not.
8
+ * * @param udyam_no UDYAM no. to be validated
9
+ * @returns Boolean
10
+ *
11
+ * Validation Rules:
12
+ * 1. UDYAM- → fixed prefix
13
+ * 2. [A-Z]{2} → valid 2-letter state code
14
+ * 3. \d{2} → 2 digits for district code
15
+ * 4. \d{7} → 7-digit unique number
16
+ */
17
+ function isValidUdyam(udyam_no) {
18
+ return exports.UDYAM_REGEX.test(udyam_no);
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kcommons",
3
- "version": "13.12.2",
3
+ "version": "13.12.3",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",