ind-utils-pro 1.0.0 โ†’ 1.1.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 CHANGED
@@ -1,35 +1,765 @@
1
1
  # ๐Ÿ‡ฎ๐Ÿ‡ณ Ind-Utils-Pro
2
- A professional, lightweight, and framework-agnostic Indian utility library for Angular, React, Vue, and Node.js.
3
2
 
4
- ## ๐Ÿš€ Features
5
- - **Identity:** PAN, GST, Aadhar, VoterID, Passport, Driving License.
6
- - **Finance:** IFSC, Account Number, TAN, DIN, CIN, Currency to Words.
7
- - **Location:** Pincode, Mobile, Vehicle Registration.
8
- - **Formatting:** Indian Rupee (INR) formatting.
3
+ > A comprehensive, production-ready Indian utility library with **110+ regex patterns**, **105+ validation/formatting methods**, and **zero dependencies** for modern JavaScript applications.
4
+
5
+ **Author:** [Dhruv Gorasiya](https://github.com/DHRUV0021)
6
+ **License:** MIT
7
+ **Framework Agnostic:** React โ€ข Vue โ€ข Angular โ€ข Node.js โ€ข Vanilla JS โ€ข Svelte โ€ข Next.js โ€ข Nuxt
8
+
9
+ ---
10
+
11
+ ## ๐Ÿ“Š Quick Feature Matrix
12
+
13
+ | Feature | Count | Examples |
14
+ |---------|-------|----------|
15
+ | ๐Ÿ†” **Government IDs** | 9 | PAN, GST, Aadhar, Passport, DL, Voter ID |
16
+ | ๐Ÿฆ **Banking & Finance** | 9 | IFSC, MICR, Account, SWIFT, IBAN, Cards |
17
+ | ๐Ÿ“ž **Contact & Location** | 8 | Mobile, Email, Pincode, Address, Coordinates |
18
+ | ๐ŸŒ **Internet & Web** | 7 | URL, IPv4, IPv6, Email, JWT, Base64 |
19
+ | ๐Ÿš— **Vehicles** | 6 | Registration, VIN, Chassis, Engine Number |
20
+ | ๐Ÿ’ผ **Business & Corporate** | 6 | License, Trademark, Patent, FSSAI, Udyam |
21
+ | ๐Ÿ’ณ **Financial Instruments** | 7 | Credit Card, Debit Card, CVV, IBAN, Currency |
22
+ | ๐Ÿ“Š **Documents & Codes** | 8 | Invoice, Bill, PO, Tracking, Barcode, QR |
23
+ | ๐Ÿ“… **Date & Time** | 6 | Multiple formats + ISO timestamp |
24
+ | ๐Ÿ”ค **Text & Format** | 20+ | Alphanumeric, Slug, Color, Percentage, etc. |
25
+ | ๐Ÿ“ฑ **Social Media** | 6 | Twitter, Instagram, Facebook, YouTube |
26
+ | ๐Ÿ’ฐ **Currency Formatters** | 40+ | INR, USD, EUR, GBP, JPY, AUD, CAD, SGD, HKD |
27
+
28
+ ---
29
+
30
+ ## ๐Ÿš€ Installation
9
31
 
10
- ## ๐Ÿ“ฆ Installation
11
32
  ```bash
33
+ # npm
12
34
  npm install ind-utils-pro
13
35
 
36
+ # yarn
37
+ yarn add ind-utils-pro
38
+
39
+ # pnpm
40
+ pnpm add ind-utils-pro
41
+
42
+ # bun
43
+ bun add ind-utils-pro
44
+ ```
45
+
46
+ ---
47
+
48
+ ## ๐Ÿ“– Quick Start
49
+
50
+ ### Basic Usage
51
+
52
+ ```typescript
53
+ import {
54
+ isValidPAN,
55
+ isValidGST,
56
+ toINR,
57
+ calculateGST
58
+ } from 'ind-utils-pro';
59
+
60
+ // Validate PAN
61
+ isValidPAN('ABCDE1234F'); // true
62
+
63
+ // Validate GST
64
+ isValidGST('24AAAAA0000A1Z5'); // true
65
+
66
+ // Format currency
67
+ toINR(15000); // โ‚น15,000.00
68
+
69
+ // Calculate tax
70
+ calculateGST(10000, 18); // 1800
71
+ ```
72
+
73
+ ### React Example
74
+
75
+ ```typescript
76
+ import { useForm } from 'react-hook-form';
77
+ import { isValidPAN, isValidGST, isValidMobile } from 'ind-utils-pro';
78
+
79
+ export function CompanyForm() {
80
+ const { register, handleSubmit, formState: { errors } } = useForm();
81
+
82
+ const validatePAN = (value) => isValidPAN(value) || 'Invalid PAN';
83
+ const validateGST = (value) => isValidGST(value) || 'Invalid GST';
84
+ const validateMobile = (value) => isValidMobile(value) || 'Invalid Mobile';
85
+
86
+ return (
87
+ <form onSubmit={handleSubmit(onSubmit)}>
88
+ <input
89
+ {...register('pan', { validate: validatePAN })}
90
+ placeholder="Enter PAN"
91
+ />
92
+ {errors.pan && <span>{errors.pan.message}</span>}
93
+
94
+ <input
95
+ {...register('gst', { validate: validateGST })}
96
+ placeholder="Enter GST"
97
+ />
98
+ {errors.gst && <span>{errors.gst.message}</span>}
99
+
100
+ <input
101
+ {...register('mobile', { validate: validateMobile })}
102
+ placeholder="Enter Mobile"
103
+ />
104
+ {errors.mobile && <span>{errors.mobile.message}</span>}
105
+
106
+ <button type="submit">Submit</button>
107
+ </form>
108
+ );
109
+ }
110
+ ```
111
+
112
+ ### Angular Example
113
+
114
+ ```typescript
115
+ import { Component } from '@angular/core';
116
+ import { isValidGST, calculateGST, toINR } from 'ind-utils-pro';
117
+
118
+ @Component({
119
+ selector: 'app-invoice',
120
+ template: `
121
+ <div class="invoice">
122
+ <p *ngIf="isGstValid" class="success">GST is valid</p>
123
+ <p>Base Amount: {{ baseAmount | currency }}</p>
124
+ <p>GST (18%): {{ gstAmount | currency }}</p>
125
+ <p>Total: {{ totalAmount | currency }}</p>
126
+ </div>
127
+ `,
128
+ })
129
+ export class InvoiceComponent {
130
+ gst = '24AAAAA0000A1Z5';
131
+ baseAmount = 10000;
132
+ gstAmount = 0;
133
+ totalAmount = 0;
134
+ isGstValid = false;
135
+
136
+ ngOnInit() {
137
+ this.isGstValid = isValidGST(this.gst);
138
+ this.gstAmount = calculateGST(this.baseAmount, 18);
139
+ this.totalAmount = this.baseAmount + this.gstAmount;
140
+ }
141
+ }
142
+ ```
143
+
144
+ ### Node.js / Express Example
145
+
146
+ ```typescript
147
+ const express = require('express');
148
+ const { isValidPincode, isValidMobile, toIndianWords } = require('ind-utils-pro');
149
+
150
+ const app = express();
151
+
152
+ app.post('/api/validate', (req, res) => {
153
+ const { pincode, mobile, amount } = req.body;
154
+
155
+ const isPincodeValid = isValidPincode(pincode);
156
+ const isMobileValid = isValidMobile(mobile);
157
+ const amountInWords = toIndianWords(amount);
158
+
159
+ res.json({
160
+ isPincodeValid,
161
+ isMobileValid,
162
+ amountInWords,
163
+ status: isPincodeValid && isMobileValid ? 'valid' : 'invalid'
164
+ });
165
+ });
166
+
167
+ app.listen(3000, () => console.log('Server running on port 3000'));
168
+ ```
169
+
170
+ ---
171
+
172
+ ## ๐ŸŽฏ Use Cases
173
+
174
+ ### 1. **E-Commerce Platforms**
175
+ - โœ… Validate customer PAN/GST during registration
176
+ - โœ… Calculate and display GST in invoices
177
+ - โœ… Format prices in multiple currencies
178
+ - โœ… Validate payment card details
179
+ - โœ… Track shipments with tracking number validation
180
+
181
+ ### 2. **Financial Applications**
182
+ - โœ… Bank account and IFSC code validation
183
+ - โœ… Multi-currency conversion and formatting
184
+ - โœ… Tax calculation and reporting
185
+ - โœ… Payment gateway integration
186
+ - โœ… Credit card validation with CVV/expiry
187
+
188
+ ### 3. **Business Management Systems**
189
+ - โœ… Invoice and bill number generation/validation
190
+ - โœ… Purchase order tracking
191
+ - โœ… GST compliance verification
192
+ - โœ… Business document management
193
+ - โœ… Vendor/supplier validation (PAN, GSTIN)
194
+
195
+ ### 4. **Logistics & Delivery**
196
+ - โœ… Vehicle registration number validation
197
+ - โœ… Tracking number validation
198
+ - โœ… Address and pincode verification
199
+ - โœ… Delivery partner contact validation
200
+ - โœ… Route optimization with coordinates
201
+
202
+ ### 5. **Government & Compliance**
203
+ - โœ… Aadhar, PAN, Voter ID validation
204
+ - โœ… Passport and Driving License verification
205
+ - โœ… GST registration validation
206
+ - โœ… FSSAI license validation (food businesses)
207
+ - โœ… Udyam registration verification
208
+
209
+ ### 6. **Digital Services**
210
+ - โœ… Email and URL validation
211
+ - โœ… Password strength validation
212
+ - โœ… JWT token validation
213
+ - โœ… Social media handle verification
214
+ - โœ… User registration form validation
215
+
216
+ ### 7. **Real Estate**
217
+ - โœ… Address validation and standardization
218
+ - โœ… GPS coordinates validation
219
+ - โœ… Property document validation
220
+ - โœ… Payment processing with GST
221
+ - โœ… Owner/agent contact validation
222
+
223
+ ### 8. **Education & Enrollment**
224
+ - โœ… Student email and contact validation
225
+ - โœ… Parent/Guardian mobile verification
226
+ - โœ… Address verification for enrollment
227
+ - โœ… Invoice generation for fees with GST
228
+ - โœ… Document tracking for admissions
229
+
230
+ ---
231
+
232
+ ## ๐Ÿ“š Complete API Reference
233
+
234
+ ### ๐Ÿ†” Identity & Government (9 validators)
235
+
236
+ ```typescript
237
+ isValidPAN(value: string): boolean // Pan card: ABCDE1234F
238
+ isValidGST(value: string): boolean // GST: 24AAAAA0000A1Z5
239
+ isValidAadhar(value: string): boolean // Aadhar: 12-digit number (prefix 2-9)
240
+ isValidAadharMasked(value: string): boolean // Masked Aadhar: XXXX XXXX XXXX
241
+ isValidVoterID(value: string): boolean // Voter ID: ABC1234567
242
+ isValidPassport(value: string): boolean // Passport: A1234567
243
+ isValidPassportIntl(value: string): boolean // International passport format
244
+ isValidDrivingLicense(value: string): boolean // Driving License: Full format
245
+ isValidDrivingLicenseSimple(value: string): boolean // Driving License: Simplified
246
+ ```
247
+
248
+ ### ๐Ÿฆ Banking & Finance (9 validators)
249
+
250
+ ```typescript
251
+ isValidIFSC(value: string): boolean // IFSC: SBIN0001234
252
+ isValidIFSCStandard(value: string): boolean // IFSC: Standard format
253
+ isValidMICR(value: string): boolean // MICR: 9-digit code
254
+ isValidBankAccount(value: string): boolean // 9-18 digit account numbers
255
+ isValidBankAccountFormatted(value: string): boolean // Formatted: 1234 5678 9012 3456
256
+ isValidTAN(value: string): boolean // TAN: AAAA01234A
257
+ isValidDIN(value: string): boolean // DIN: 8-digit number
258
+ isValidCIN(value: string): boolean // CIN: Corporate identity
259
+ isValidSwiftCode(value: string): boolean // SWIFT: SBIN INJU 010
260
+ ```
261
+
262
+ ### ๐Ÿ“ž Contact & Location (8 validators)
263
+
264
+ ```typescript
265
+ isValidMobile(value: string): boolean // Indian mobile: 10 digits (6-9 start)
266
+ isValidMobileWithCountry(value: string): boolean // With +91: +919876543210
267
+ isValidMobileIntl(value: string): boolean // International format
268
+ isValidPincode(value: string): boolean // Indian postal: 6 digits
269
+ isValidPincode6Digit(value: string): boolean // 6-digit format specifically
270
+ isValidLandline(value: string): boolean // Landline with STD code
271
+ isValidSTDCode(value: string): boolean // STD Code: 0XX, 0XXX, 0XXXX
272
+ isValidPhoneWithExtension(value: string): boolean // Extension format: 040-1234 x 123
273
+ ```
274
+
275
+ ### ๐ŸŒ Email & Internet (7 validators)
276
+
277
+ ```typescript
278
+ isValidEmail(value: string): boolean // Basic email validation
279
+ isValidEmailStrict(value: string): boolean // RFC 5322 compliant
280
+ isValidURL(value: string): boolean // URL validation (http/https optional)
281
+ isValidURLStrict(value: string): boolean // Strict HTTPS requirement
282
+ isValidIPv4(value: string): boolean // IPv4: 192.168.1.1
283
+ isValidIPv6(value: string): boolean // IPv6: Full format
284
+ isValidIPv6Simple(value: string): boolean // IPv6: Simplified format
285
+ ```
286
+
287
+ ### ๐Ÿš— Vehicle (6 validators)
288
+
289
+ ```typescript
290
+ isValidVehicleNo(value: string): boolean // Registration: GJ01AB1234
291
+ isValidVehicleNoNew(value: string): boolean // New format variant
292
+ isValidVIN(value: string): boolean // VIN: 17-character code
293
+ isValidChassisNumber(value: string): boolean // Chassis number
294
+ isValidEngineNumber(value: string): boolean // Engine number
295
+ isValidRCNumber(value: string): boolean // RC registration number
296
+ ```
297
+
298
+ ### ๐Ÿ’ผ Business & Corporate (6 validators)
299
+
300
+ ```typescript
301
+ isValidCRN(value: string): boolean // Company Incorporation Number
302
+ isValidLicenseNumber(value: string): boolean // Business license
303
+ isValidTrademark(value: string): boolean // Trademark registration
304
+ isValidPatentNumber(value: string): boolean // Patent number
305
+ isValidFSSAI(value: string): boolean // Food Safety License: 14 digits
306
+ isValidUdyam(value: string): boolean // Udyam Registration: UDYAM format
307
+ ```
308
+
309
+ ### ๐Ÿ’ณ Financial & Payment (7 validators)
310
+
311
+ ```typescript
312
+ isValidCreditCard(value: string): boolean // Credit card: 13-19 digits
313
+ isValidCreditCardFormatted(value: string): boolean // Formatted: 1234 5678 9012 3456
314
+ isValidDebitCard(value: string): boolean // Debit card: 16 digits
315
+ isValidCardCVV(value: string): boolean // CVV/CVC: 3-4 digits
316
+ isValidCardExpiry(value: string): boolean // Expiry: MM/YY format
317
+ isValidIFSCWithDash(value: string): boolean // IFSC with dash: SBIN-0001234
318
+ isValidIBAN(value: string): boolean // IBAN: International account
319
+ ```
320
+
321
+ ### ๐Ÿ“Š Documents & Codes (8 validators)
322
+
323
+ ```typescript
324
+ isValidGSTInvoice(value: string): boolean // GST Invoice: ABC12345678901234
325
+ isValidBillNumber(value: string): boolean // Bill: BLXXXXXXXX
326
+ isValidInvoiceNumber(value: string): boolean // Invoice: INVXXXXXXXX
327
+ isValidPurchaseOrder(value: string): boolean // PO: POXXXXXXXX
328
+ isValidReferenceCode(value: string): boolean // Reference: ABCXXXXXX
329
+ isValidTrackingNumber(value: string): boolean // Tracking: Alphanumeric
330
+ isValidBarcode128(value: string): boolean // Barcode 128 format
331
+ isValidQRCode(value: string): boolean // QR code string
332
+ ```
333
+
334
+ ### ๐Ÿ“… Date & Time (6 validators)
335
+
336
+ ```typescript
337
+ isValidDateDDMMYYYY(value: string): boolean // DD/MM/YYYY or DD-MM-YYYY
338
+ isValidDateYYYYMMDD(value: string): boolean // YYYY/MM/DD or YYYY-MM-DD
339
+ isValidDateDDMMYY(value: string): boolean // DDMMYY compact format
340
+ isValidTimeHHMM(value: string): boolean // HH:MM (24-hour)
341
+ isValidTimeHHMMSS(value: string): boolean // HH:MM:SS
342
+ isValidTimestampISO(value: string): boolean // ISO 8601 timestamp
343
+ ```
344
+
345
+ ### ๐Ÿ”ค Text & Format (20+ validators)
346
+
347
+ ```typescript
348
+ isAlphabetOnly(value: string): boolean // Letters and spaces
349
+ isAlphabetOnlyNoSpace(value: string): boolean // Letters only
350
+ isNumbersOnly(value: string): boolean // Digits only
351
+ isAlphanumeric(value: string): boolean // Letters + numbers
352
+ isAlphanumericUnderscore(value: string): boolean // + underscores
353
+ isAlphanumericDash(value: string): boolean // + dashes
354
+ isValidSlug(value: string): boolean // URL slug: abc-def-123
355
+ isValidHexColor(value: string): boolean // Hex color: #RRGGBB or #RGB
356
+ isValidRGBColor(value: string): boolean // rgb(255,255,255)
357
+ isValidRGBAColor(value: string): boolean // rgba(255,255,255,0.5)
358
+ isValidDecimalNumber(value: string): boolean // XX.XX format
359
+ isValidDecimalAmount(value: string): boolean // Amount with decimals
360
+ isValidPercentage(value: string): boolean // 0-100%
361
+ ```
362
+
363
+ ### ๐Ÿ” Password & Security (5 validators)
364
+
365
+ ```typescript
366
+ isValidPasswordStrong(value: string): boolean // 8+ chars, mixed case, digit, symbol
367
+ isValidPasswordMedium(value: string): boolean // 8+ chars, mixed case, digit
368
+ isValidPasswordSimple(value: string): boolean // Min 8 characters
369
+ isValidJWT(value: string): boolean // JWT token format
370
+ isValidBase64(value: string): boolean // Base64 encoding
371
+ ```
372
+
373
+ ### ๐Ÿ“ Address & Location (5 validators)
374
+
375
+ ```typescript
376
+ isValidAddress(value: string): boolean // Full mailing address
377
+ isValidLatitude(value: string): boolean // -90 to +90
378
+ isValidLongitude(value: string): boolean // -180 to +180
379
+ isValidCoordinates(value: string): boolean // Lat,Long pair
380
+ isValidZipCodeUS(value: string): boolean // US ZIP or ZIP+4
381
+ ```
382
+
383
+ ### ๐Ÿ“ฆ Product Codes (4 validators)
384
+
385
+ ```typescript
386
+ isValidUPC(value: string): boolean // UPC: 12 digits
387
+ isValidEAN(value: string): boolean // EAN: 13 digits
388
+ isValidISBN(value: string): boolean // ISBN book code
389
+ isValidGTIN(value: string): boolean // GTIN: 8-14 digits
390
+ isValidASIN(value: string): boolean // Amazon ASIN: 10-char
391
+ isValidSerialNumber(value: string): boolean // Product serial
392
+ ```
393
+
394
+ ### ๐Ÿ“ฑ Social Media (6 validators)
395
+
396
+ ```typescript
397
+ isValidTwitterHandle(value: string): boolean // @handle (1-15 characters)
398
+ isValidInstagramHandle(value: string): boolean // @handle (1-30 characters)
399
+ isValidFacebookID(value: string): boolean // Numeric FB ID
400
+ isValidYoutubeChannel(value: string): boolean // UC... format
401
+ isValidHashtag(value: string): boolean // #hashtag format
402
+ isValidMention(value: string): boolean // @mention format
403
+ ```
404
+
405
+ ### ๐Ÿ“ Measurements (4 validators)
406
+
407
+ ```typescript
408
+ isValidWeightKg(value: string): boolean // 50kg, 50.5 kg format
409
+ isValidDistanceKm(value: string): boolean // 100km, 100.5 km format
410
+ isValidTemperature(value: string): boolean // 25ยฐC, 77ยฐF format
411
+ isValidCurrency(value: string): boolean // โ‚น, $, โ‚ฌ, ยฅ format
412
+ ```
413
+
414
+ ---
415
+
416
+ ## ๐Ÿ’ฐ Currency & Formatting (40+ methods)
417
+
418
+ ### Indian Rupee Formatters
419
+
420
+ ```typescript
421
+ toINR(15000) // โ‚น15,000.00
422
+ toINRWithoutSymbol(15000) // 15,000.00
423
+ toINRCompact(15000000) // โ‚น1.5Cr
424
+ toINRCompact(1500000) // โ‚น15L
425
+ toINRCompact(1500) // โ‚น1.5K
426
+ ```
427
+
428
+ ### International Currency Formatters
429
+
430
+ ```typescript
431
+ toUSD(15000) // $15,000.00
432
+ toEUR(15000) // โ‚ฌ15,000.00
433
+ toGBP(15000) // ยฃ15,000.00
434
+ toJPY(15000) // ยฅ15,000
435
+ toAUD(15000) // A$15,000.00
436
+ toCAD(15000) // C$15,000.00
437
+ toSGD(15000) // S$15,000.00
438
+ toHKD(15000) // HK$15,000.00
439
+ formatCurrency(15000, 'CHF', 'de') // Custom currency & locale
440
+ ```
441
+
442
+ ### Number Formatting
443
+
444
+ ```typescript
445
+ formatDecimal(15000.5555, 2) // 15000.56
446
+ formatNumberWithCommas(15000) // 15,000
447
+ formatNumberWithCommasAndDecimals(15000, 2) // 15,000.00
448
+ formatDecimalAmount(15000, 2) // 15,000.00
449
+ ```
450
+
451
+ ### Percentage Formatting
452
+
453
+ ```typescript
454
+ formatPercentage(0.25, 2) // 25.00%
455
+ formatPercentageSimple(0.25) // 25%
456
+ formatPercentageChange(100, 125, 2) // +25.00%
457
+ formatPercentageChange(100, 75, 2) // -25.00%
458
+ ```
459
+
460
+ ### Amount Operations
461
+
462
+ ```typescript
463
+ formatAmount(15000, 'โ‚น') // โ‚น15000.00
464
+ formatAmountWithoutDecimals(15000, '$') // $15000
465
+ formatAmountInWords(5000) // Five Thousand Rupees Only
466
+ ```
467
+
468
+ ### Tax & Discount Calculations
469
+
470
+ ```typescript
471
+ calculateGST(10000, 18) // 1800 (18% tax)
472
+ calculateGST(10000) // 1800 (default 18%)
473
+ calculateGSTInclusive(11800, 18) // {baseAmount: 10000, gst: 1800, total: 11800}
474
+ calculateDiscount(1000, 20) // 200 (20% off)
475
+ calculateDiscountedAmount(1000, 20) // 800 (final price)
476
+ calculateMarkup(500, 100) // 1000 (100% markup)
477
+ calculateMargin(1000, 500) // 50 (50% margin)
478
+ ```
479
+
480
+ ### Currency Conversion
481
+
482
+ ```typescript
483
+ // Convert 5000 INR to USD (1 USD = 83 INR)
484
+ convertCurrency(5000, 83, 1) // 60.24 USD
485
+
486
+ // Convert 5000 INR to EUR (1 EUR = 90 INR)
487
+ convertCurrency(5000, 90, 1) // 55.56 EUR
488
+ ```
489
+
490
+ ### Amount Rounding
491
+
492
+ ```typescript
493
+ roundToNearest(15.6, 0.5) // 15.5
494
+ roundUp(15.1, 2) // 15.11
495
+ roundDown(15.9, 2) // 15.89
496
+ ```
497
+
498
+ ### Utility Functions
499
+
500
+ ```typescript
501
+ toIndianWords(5000) // Five Thousand Rupees Only
502
+ toIndianWords(1234567) // Twelve Lakh Thirty Four Thousand...
503
+ getAmountInPaisa(100) // 10000
504
+ getAmountInRupees(10000) // 100
505
+ isValidAmount(500) // true
506
+ isValidAmount('abc') // false
507
+ clampAmount(150, 0, 100) // 100 (clamped to max)
508
+ ```
509
+
510
+ ---
511
+
512
+ ## ๐ŸŽจ Advanced Usage
513
+
514
+ ### Custom Pattern Validation
515
+
516
+ ```typescript
517
+ import { validateWithPattern } from 'ind-utils-pro';
518
+
519
+ const isPanValid = validateWithPattern('ABCDE1234F', 'PAN');
520
+ const isGstValid = validateWithPattern('24AAAAA0000A1Z5', 'GST');
521
+ const isEmailValid = validateWithPattern('test@example.com', 'EMAIL_STRICT');
522
+ ```
523
+
524
+ ### Direct Pattern Access
525
+
526
+ ```typescript
527
+ import { REGEX } from 'ind-utils-pro';
528
+
529
+ // Use regex patterns directly
530
+ if (REGEX.PAN.test(panValue)) {
531
+ console.log('Valid PAN');
532
+ }
533
+
534
+ // Create custom validators
535
+ const myValidator = (value) => REGEX.ALPHANUMERIC.test(value);
536
+ ```
537
+
538
+ ### TypeScript Types
539
+
540
+ ```typescript
541
+ import { REGEX } from 'ind-utils-pro';
542
+
543
+ type PatternKey = keyof typeof REGEX;
544
+
545
+ function validate(value: string, pattern: PatternKey): boolean {
546
+ return REGEX[pattern].test(value);
547
+ }
548
+ ```
549
+
550
+ ---
551
+
552
+ ## ๐Ÿ“Š Real-World Examples
553
+
554
+ ### E-Commerce Invoice
555
+
556
+ ```typescript
557
+ import {
558
+ isValidGST,
559
+ calculateGST,
560
+ formatPercentageChange,
561
+ toINR
562
+ } from 'ind-utils-pro';
563
+
564
+ const invoice = {
565
+ seller: { gstin: '24AAAAA0000A1Z5' },
566
+ items: [
567
+ { name: 'Product 1', price: 1000, qty: 2 },
568
+ { name: 'Product 2', price: 500, qty: 1 }
569
+ ],
570
+ discountPercent: 10
571
+ };
572
+
573
+ if (isValidGST(invoice.seller.gstin)) {
574
+ const subtotal = 2500; // calculated sum
575
+ const discount = 250; // 10% discount
576
+ const taxable = subtotal - discount; // 2250
577
+ const gst = calculateGST(taxable, 18); // 405
578
+ const total = taxable + gst; // 2655
579
+
580
+ console.log(`Subtotal: ${toINR(subtotal)}`);
581
+ console.log(`Discount: ${toINR(discount)}`);
582
+ console.log(`Taxable: ${toINR(taxable)}`);
583
+ console.log(`GST (18%): ${toINR(gst)}`);
584
+ console.log(`Total: ${toINR(total)}`);
585
+ console.log(`Margin: ${formatPercentageChange(subtotal, total)}`);
586
+ }
587
+ ```
588
+
589
+ ### Form Validation
590
+
591
+ ```typescript
592
+ import {
593
+ isValidPAN,
594
+ isValidGST,
595
+ isValidMobile,
596
+ isValidEmail,
597
+ isValidPincode
598
+ } from 'ind-utils-pro';
599
+
600
+ const formData = {
601
+ pan: 'ABCDE1234F',
602
+ gst: '24AAAAA0000A1Z5',
603
+ mobile: '9876543210',
604
+ email: 'test@example.com',
605
+ pincode: '380001'
606
+ };
607
+
608
+ const isFormValid =
609
+ isValidPAN(formData.pan) &&
610
+ isValidGST(formData.gst) &&
611
+ isValidMobile(formData.mobile) &&
612
+ isValidEmail(formData.email) &&
613
+ isValidPincode(formData.pincode);
614
+
615
+ console.log('Form is valid:', isFormValid);
616
+ ```
617
+
618
+ ### Multi-Currency Pricing
619
+
620
+ ```typescript
621
+ import { convertCurrency, formatCurrency } from 'ind-utils-pro';
622
+
623
+ const priceINR = 15000;
624
+ const rates = { INR: 1, USD: 83, EUR: 90, GBP: 105 };
625
+
626
+ const prices = {
627
+ INR: priceINR,
628
+ USD: convertCurrency(priceINR, rates.INR, rates.USD),
629
+ EUR: convertCurrency(priceINR, rates.INR, rates.EUR),
630
+ GBP: convertCurrency(priceINR, rates.INR, rates.GBP)
631
+ };
632
+
633
+ console.log(formatCurrency(prices.INR, 'INR')); // โ‚น15,000.00
634
+ console.log(formatCurrency(prices.USD, 'USD')); // $180.72
635
+ console.log(formatCurrency(prices.EUR, 'EUR')); // โ‚ฌ166.67
636
+ console.log(formatCurrency(prices.GBP, 'GBP')); // ยฃ142.86
637
+ ```
638
+
639
+ ---
640
+
641
+ ## ๐Ÿงช Testing
642
+
643
+ ```typescript
644
+ import { isValidPAN, isValidGST, toINR, calculateGST } from 'ind-utils-pro';
645
+
646
+ describe('Ind-Utils-Pro Validators', () => {
647
+ test('should validate PAN correctly', () => {
648
+ expect(isValidPAN('ABCDE1234F')).toBe(true);
649
+ expect(isValidPAN('INVALID')).toBe(false);
650
+ });
651
+
652
+ test('should validate GST correctly', () => {
653
+ expect(isValidGST('24AAAAA0000A1Z5')).toBe(true);
654
+ expect(isValidGST('INVALID')).toBe(false);
655
+ });
656
+
657
+ test('should format currency correctly', () => {
658
+ expect(toINR(5000)).toBe('โ‚น5,000.00');
659
+ expect(toINR(0)).toBe('โ‚น0.00');
660
+ });
661
+
662
+ test('should calculate GST correctly', () => {
663
+ expect(calculateGST(10000, 18)).toBe(1800);
664
+ expect(calculateGST(10000)).toBe(1800); // Default 18%
665
+ });
666
+ });
667
+ ```
668
+
669
+ ---
670
+
671
+ ## ๐ŸŒŸ Key Benefits
672
+
673
+ โœ… **Zero Dependencies** โ€“ Ultra-lightweight, no external packages
674
+ โœ… **Production Ready** โ€“ Used in production applications
675
+ โœ… **Type Safe** โ€“ Full TypeScript support with IntelliSense
676
+ โœ… **Framework Agnostic** โ€“ Works with any JavaScript framework
677
+ โœ… **Indian Focused** โ€“ Built for Indian business requirements
678
+ โœ… **Comprehensive** โ€“ 110+ patterns, 105+ methods
679
+ โœ… **Easy to Use** โ€“ Simple, intuitive API
680
+ โœ… **Well Documented** โ€“ Extensive examples and use cases
681
+ โœ… **Performance** โ€“ Optimized regex patterns
682
+ โœ… **Tree-Shakeable** โ€“ Import only what you need
683
+
684
+ ---
685
+
686
+ ## ๐Ÿ“ฆ Bundle Size
687
+
688
+ ```
689
+ Minified: ~8 KB
690
+ Gzipped: ~3 KB
691
+ ```
692
+
693
+ ---
694
+
695
+ ## ๐Ÿค Contributing
696
+
697
+ Contributions are welcome! Please feel free to submit issues and enhancement requests on [GitHub](https://github.com/DHRUV0021).
698
+
699
+ ### Development
700
+
701
+ ```bash
702
+ # Clone the repository
703
+ git clone https://github.com/DHRUV0021
704
+
705
+ # Install dependencies
706
+ npm install
707
+
708
+ # Build
709
+ npm run build
710
+
711
+ # Watch mode for development
712
+ npm run dev
713
+
714
+ # Run tests
715
+ npm test
716
+ ```
717
+
718
+ ---
719
+
720
+ ## ๐Ÿ“ License
721
+
722
+ MIT ยฉ 2024 [Dhruv Gorasiya](https://github.com/DHRUV0021)
723
+
724
+ See [LICENSE](./LICENSE) file for details.
725
+
726
+ ---
727
+
728
+ ## ๐Ÿ’ฌ Support
729
+
730
+ For issues, questions, or suggestions:
731
+ - ๐Ÿ“Œ Open an issue on [GitHub](https://github.com/DHRUV0021/ind-utils-pro/issues)
732
+
733
+ ---
734
+
735
+ ## ๐ŸŽฏ Roadmap
736
+
737
+ - [ ] Add regex pattern builder utility
738
+ - [ ] Add batch validation methods
739
+ - [ ] Add localization support
740
+ - [ ] Add form integration plugins (Formik, React Hook Form)
741
+ - [ ] Add CLI tool for testing patterns
742
+ - [ ] Add Web version (browser-ready)
743
+ - [ ] Add more international patterns
744
+
745
+ ---
14
746
 
15
- # ================= In React / Vue / Vanilla JS =================
16
- # import { IndUtils } from 'ind-utils-pro';
747
+ ## ๐Ÿ™ Acknowledgments
17
748
 
18
- # const isPanValid = IndUtils.isValidPAN('ABCDE1234F'); // true
19
- # const amountInWords = IndUtils.toIndianWords(5000); // Five Thousand Rupees Only
749
+ Built with โค๏ธ for the Indian developer community.
20
750
 
751
+ **Made with โค๏ธ by [Dhruv Gorasiya](https://github.com/DHRUV0021)**
21
752
 
22
- # ================= In Angular =================
23
- # import { IndUtils } from 'ind-utils-pro';
753
+ ---
24
754
 
25
- # export class AppComponent {
26
- # checkGst() {
27
- # const isValid = IndUtils.isValidGST('24AAAAA0000A1Z5');
28
- # console.log(isValid);
29
- # }
30
- # }
755
+ ## ๐Ÿ“Š Statistics
31
756
 
757
+ - **110+** Regex patterns
758
+ - **105+** Validation & Formatting methods
759
+ - **0** Dependencies
760
+ - **40+** Currency formatters
761
+ - **20+** Framework compatible
32
762
 
33
- # ================= In Node.js =================
34
- # const { IndUtils } = require('ind-utils-pro');
35
- # console.log(IndUtils.isValidPincode('380001'));
763
+ **Version:** 1.0.0
764
+ **License:** MIT
765
+ **Last Updated:** March 25, 2024