ind-utils-pro 1.0.0 → 1.2.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.
- package/README.md +752 -22
- package/dist/constants/patterns.d.ts +107 -0
- package/dist/formatters/currency.d.ts +41 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +153 -0
- package/dist/index.js +1 -0
- package/dist/validators/identity.d.ts +114 -0
- package/package.json +52 -5
- package/src/constants/patterns.ts +0 -23
- package/src/formatters/currency.ts +0 -28
- package/src/index.ts +0 -11
- package/src/validators/identity.ts +0 -23
- package/tsconfig.json +0 -15
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const toINR = (amount: number): string => {
|
|
2
|
-
if (isNaN(amount)) return '₹0.00';
|
|
3
|
-
return new Intl.NumberFormat('en-IN', {
|
|
4
|
-
style: 'currency',
|
|
5
|
-
currency: 'INR',
|
|
6
|
-
}).format(amount);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const toIndianWords = (num: number): string => {
|
|
10
|
-
const a = ['', 'One ', 'Two ', 'Three ', 'Four ', 'Five ', 'Six ', 'Seven ', 'Eight ', 'Nine ', 'Ten ', 'Eleven ', 'Twelve ', 'Thirteen ', 'Fourteen ', 'Fifteen ', 'Sixteen ', 'Seventeen ', 'Eighteen ', 'Nineteen '];
|
|
11
|
-
const b = ['', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'];
|
|
12
|
-
|
|
13
|
-
// સંખ્યાને સ્ટ્રિંગમાં કન્વર્ટ કરવા માટે નવો વેરીએબલ વાપરો (Error Fix)
|
|
14
|
-
const numStr = num.toString();
|
|
15
|
-
if (numStr.length > 9) return 'Overflow';
|
|
16
|
-
|
|
17
|
-
const n = ('000000000' + numStr).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
|
|
18
|
-
if (!n) return '';
|
|
19
|
-
|
|
20
|
-
let str = '';
|
|
21
|
-
str += (Number(n[1]) !== 0) ? (a[Number(n[1])] || b[parseInt(n[1][0])] + ' ' + a[parseInt(n[1][1])]) + 'Crore ' : '';
|
|
22
|
-
str += (Number(n[2]) !== 0) ? (a[Number(n[2])] || b[parseInt(n[2][0])] + ' ' + a[parseInt(n[2][1])]) + 'Lakh ' : '';
|
|
23
|
-
str += (Number(n[3]) !== 0) ? (a[Number(n[3])] || b[parseInt(n[3][0])] + ' ' + a[parseInt(n[3][1])]) + 'Thousand ' : '';
|
|
24
|
-
str += (Number(n[4]) !== 0) ? (a[Number(n[4])] || b[parseInt(n[4][0])] + ' ' + a[parseInt(n[4][1])]) + 'Hundred ' : '';
|
|
25
|
-
str += (Number(n[5]) !== 0) ? ((str !== '') ? 'and ' : '') + (a[Number(n[5])] || b[parseInt(n[5][0])] + ' ' + a[parseInt(n[5][1])]) + 'Rupees Only' : '';
|
|
26
|
-
|
|
27
|
-
return str.trim();
|
|
28
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './validators/identity';
|
|
2
|
-
export * from './constants/patterns';
|
|
3
|
-
export * from './formatters/currency';
|
|
4
|
-
|
|
5
|
-
import * as identity from './validators/identity';
|
|
6
|
-
import * as currency from './formatters/currency';
|
|
7
|
-
|
|
8
|
-
export const IndUtils = {
|
|
9
|
-
...identity,
|
|
10
|
-
...currency
|
|
11
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { REGEX } from '../constants/patterns';
|
|
2
|
-
|
|
3
|
-
// --- Government IDs ---
|
|
4
|
-
export const isValidPAN = (v: string) => REGEX.PAN.test(v?.toUpperCase());
|
|
5
|
-
export const isValidGST = (v: string) => REGEX.GST.test(v?.toUpperCase());
|
|
6
|
-
export const isValidAadhar = (v: string) => REGEX.AADHAR.test(v);
|
|
7
|
-
export const isValidVoterID = (v: string) => REGEX.VOTER_ID.test(v?.toUpperCase());
|
|
8
|
-
export const isValidPassport = (v: string) => REGEX.PASSPORT.test(v?.toUpperCase());
|
|
9
|
-
export const isValidDrivingLicense = (v: string) => REGEX.DRIVING_LICENSE.test(v?.toUpperCase());
|
|
10
|
-
|
|
11
|
-
// --- Business & Finance ---
|
|
12
|
-
export const isValidIFSC = (v: string) => REGEX.IFSC.test(v?.toUpperCase());
|
|
13
|
-
export const isValidTAN = (v: string) => REGEX.TAN.test(v?.toUpperCase());
|
|
14
|
-
export const isValidDIN = (v: string) => REGEX.DIN.test(v);
|
|
15
|
-
export const isValidCIN = (v: string) => REGEX.CIN.test(v?.toUpperCase());
|
|
16
|
-
|
|
17
|
-
// --- Contact ---
|
|
18
|
-
export const isValidPincode = (v: string) => REGEX.PINCODE.test(v);
|
|
19
|
-
export const isValidMobile = (v: string) => REGEX.MOBILE.test(v);
|
|
20
|
-
export const isValidVehicleNo = (v: string) => REGEX.VEHICLE_NO.test(v?.toUpperCase());
|
|
21
|
-
|
|
22
|
-
// --- Specialized Checks ---
|
|
23
|
-
export const isUPIDeposited = (v: string) => /^[a-zA-Z0-9.\-_]{2,256}@[a-zA-Z]{2,64}$/.test(v);
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"outDir": "dist"
|
|
12
|
-
},
|
|
13
|
-
"include": ["src/**/*"],
|
|
14
|
-
"exclude": ["node_modules", "dist"]
|
|
15
|
-
}
|