bangla-stdlib 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mahmudul Alam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,631 @@
1
+ # bangla-stdlib
2
+
3
+ A canonical, Bangladesh-correct standard library for Bangla numbers, dates, currency, and linguistic formatting.
4
+
5
+ [![NPM Version](https://img.shields.io/npm/v/bangla-stdlib.svg)](https://www.npmjs.com/package/bangla-stdlib)
6
+ [![License](https://img.shields.io/npm/l/bangla-stdlib.svg)](https://github.com/devmahmud/bangla-stdlib/blob/main/LICENSE)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
8
+
9
+ ## Principles
10
+
11
+ - **Accuracy over convenience** - Follows Bangladesh standards precisely
12
+ - **Bangladesh standards only** - No regional variations
13
+ - **Deterministic output** - Same input always produces same output
14
+ - **Zero runtime dependencies** - Pure TypeScript/JavaScript
15
+ - **Long-term stability** - API designed for consistency
16
+ - **Production-ready** - Comprehensive validation, error handling, and test coverage
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install bangla-stdlib
22
+ # or
23
+ pnpm add bangla-stdlib
24
+ # or
25
+ yarn add bangla-stdlib
26
+ ```
27
+
28
+ ## Features
29
+
30
+ ### 📊 Numbers
31
+ - Convert numbers to Bengali digits (ā§Ļ-⧝)
32
+ - Convert Bengali digits to numbers
33
+ - Number formatting with customizable options
34
+ - Number validation and sanitization
35
+ - Convert numbers to Bengali words
36
+ - Format numbers with units (āĻšāĻžāϜāĻžāϰ, āϞāĻ•ā§āώ, āϕ⧋āϟāĻŋ)
37
+ - Batch operations for arrays
38
+
39
+ ### 📅 Calendar
40
+ - Bengali calendar (āĻŦāĻ™ā§āĻ—āĻžāĻŦā§āĻĻ) support
41
+ - Convert between Gregorian and Bengali dates
42
+ - Accurate leap year calculations
43
+ - Format Bengali dates with weekdays
44
+ - Date arithmetic (add days, calculate differences)
45
+ - Date validation and comparison
46
+
47
+ ### đŸ—“ī¸ Date Formatting
48
+ - Format dates with Bengali digits and month names
49
+ - Parse Bengali date strings
50
+ - Multiple format support (with/without year, weekday)
51
+ - Date validation and sanitization
52
+ - Date comparison and range checking
53
+
54
+ ### 💰 Currency
55
+ - Format currency in Taka (ā§ŗ)
56
+ - Parse currency strings
57
+ - Currency validation
58
+ - Currency math operations (add, subtract, multiply, divide)
59
+ - Tax and discount calculations
60
+ - Amount splitting and comparison
61
+
62
+ ### 📆 Month Names
63
+ - All 12 Bengali month names
64
+ - Convert between month numbers and names
65
+ - Month validation
66
+ - Month navigation (next, previous)
67
+ - Month ranges and comparisons
68
+
69
+ ### đŸ—“ī¸ Weekday Names
70
+ - All 7 Bengali weekday names
71
+ - Convert between day numbers and names
72
+ - Weekday validation
73
+ - Weekday navigation
74
+
75
+ ### đŸŒĻī¸ Seasons
76
+ - All 6 Bengali seasons (āĻ‹āϤ⧁)
77
+ - Season detection from dates
78
+ - Season validation and comparison
79
+
80
+ ### ⏰ Time Formatting
81
+ - Format time in Bengali
82
+ - 12-hour and 24-hour support
83
+ - Bengali period names (āϏāĻ•āĻžāϞ, āĻĻ⧁āĻĒ⧁āϰ, āĻŦāĻŋāĻ•āĻžāϞ, etc.)
84
+
85
+ ### đŸ”ĸ Ordinal Numbers
86
+ - Convert numbers to Bengali ordinals (āĻĒā§āϰāĻĨāĻŽ, āĻĻā§āĻŦāĻŋāϤ⧀āϝāĻŧ, āϤ⧃āϤ⧀āϝāĻŧ, etc.)
87
+ - Ordinal validation
88
+ - Special handling for 1-25 and multiples of 10
89
+
90
+ ### 📱 Phone Numbers
91
+ - Validate Bangladeshi phone numbers
92
+ - Format phone numbers with customizable options
93
+ - Operator detection (Grameenphone, Banglalink, Robi, etc.)
94
+ - Country code handling
95
+
96
+ ### 🔤 Text Utilities
97
+ - Validate Bengali-only text
98
+ - Detect Bengali digits and characters
99
+ - Count Bengali characters
100
+ - Extract/remove Bengali content
101
+ - Mixed content detection
102
+ - Text sanitization
103
+
104
+ ## Quick Start
105
+
106
+ ```typescript
107
+ import {
108
+ toBanglaNumber,
109
+ formatCurrency,
110
+ toBengali,
111
+ formatDate,
112
+ toBanglaMonth,
113
+ getWeekdayName,
114
+ getSeason,
115
+ formatTime,
116
+ toOrdinal,
117
+ formatPhone,
118
+ } from 'bangla-stdlib';
119
+
120
+ // Numbers
121
+ toBanglaNumber(123); // "ā§§ā§¨ā§Š"
122
+ toBanglaNumber(3.14); // "ā§Š.ā§§ā§Ē"
123
+
124
+ // Currency
125
+ formatCurrency(1500); // "ā§§,ā§Ģā§Ļā§Ļ āϟāĻžāĻ•āĻž"
126
+ formatCurrency(2500, { symbol: true }); // "⧺⧍,ā§Ģā§Ļā§Ļ"
127
+
128
+ // Bengali Calendar
129
+ const bengaliDate = toBengali(new Date(2024, 3, 14));
130
+ // { year: 1431, month: 1, day: 1 } - Pohela Boishakh
131
+
132
+ // Date Formatting
133
+ formatDate(new Date(), { includeWeekday: true });
134
+ // "āĻŽāĻ™ā§āĻ—āϞāĻŦāĻžāϰ ā§­ āĻĒ⧌āώ ⧍ā§Ļ⧍ā§Ģ"
135
+
136
+ // Months
137
+ toBanglaMonth(1); // "āĻŦ⧈āĻļāĻžāĻ–"
138
+
139
+ // Weekdays
140
+ getWeekdayName(new Date()); // "āĻŽāĻ™ā§āĻ—āϞāĻŦāĻžāϰ"
141
+
142
+ // Seasons
143
+ getSeason(new Date()); // "āĻļā§€āϤ" (Winter)
144
+
145
+ // Time
146
+ formatTime(new Date()); // "āϏāĻ•āĻžāϞ ā§§ā§Ļ:ā§Šā§Ļ"
147
+
148
+ // Ordinals
149
+ toOrdinal(1); // "āĻĒā§āϰāĻĨāĻŽ"
150
+ toOrdinal(21); // "āĻāϕ⧁āĻļāϤāĻŽ"
151
+
152
+ // Phone Numbers
153
+ formatPhone('01712345678'); // "ā§Ļā§§ā§­ā§§-ā§¨ā§Šā§Ēā§Ģā§Ŧā§­ā§Ž"
154
+ ```
155
+
156
+ ## API Documentation
157
+
158
+ ### Numbers
159
+
160
+ #### `toBanglaNumber(number: number | string): string`
161
+ Converts a number or numeric string to Bengali digits.
162
+
163
+ ```typescript
164
+ toBanglaNumber(123); // "ā§§ā§¨ā§Š"
165
+ toBanglaNumber(3.14); // "ā§Š.ā§§ā§Ē"
166
+ toBanglaNumber("456"); // "ā§Ēā§Ģā§Ŧ"
167
+ ```
168
+
169
+ #### `fromBanglaNumber(banglaNumber: string): number`
170
+ Converts a Bengali digit string to a number.
171
+
172
+ ```typescript
173
+ fromBanglaNumber("ā§§ā§¨ā§Š"); // 123
174
+ fromBanglaNumber("ā§Š.ā§§ā§Ē"); // 3.14
175
+ ```
176
+
177
+ #### `formatNumber(number: number, options?): string`
178
+ Formats a number with thousands separators in Bengali.
179
+
180
+ ```typescript
181
+ formatNumber(123456); // "ā§§,ā§¨ā§Š,ā§Ēā§Ģā§Ŧ"
182
+ formatNumber(1234.56, {
183
+ minimumFractionDigits: 2,
184
+ maximumFractionDigits: 2
185
+ }); // "ā§§,ā§¨ā§Šā§Ē.ā§Ģā§Ŧ"
186
+ ```
187
+
188
+ #### `toWords(number: number): string`
189
+ Converts a number to Bengali words.
190
+
191
+ ```typescript
192
+ toWords(123); // "āĻāĻ• āĻļāϤ āϤ⧇āχāĻļ"
193
+ toWords(1000); // "āĻāĻ• āĻšāĻžāϜāĻžāϰ"
194
+ ```
195
+
196
+ #### `formatWithUnits(number: number): string`
197
+ Formats large numbers with Bengali units.
198
+
199
+ ```typescript
200
+ formatWithUnits(1000); // "ā§§ āĻšāĻžāϜāĻžāϰ"
201
+ formatWithUnits(100000); // "ā§§ āϞāĻ•ā§āώ"
202
+ formatWithUnits(10000000); // "ā§§ āϕ⧋āϟāĻŋ"
203
+ ```
204
+
205
+ ### Currency
206
+
207
+ #### `formatCurrency(amount: number, options?): string`
208
+ Formats a number as Bengali currency.
209
+
210
+ ```typescript
211
+ formatCurrency(1500); // "ā§§,ā§Ģā§Ļā§Ļ āϟāĻžāĻ•āĻž"
212
+ formatCurrency(2500, { symbol: true }); // "⧺⧍,ā§Ģā§Ļā§Ļ"
213
+ formatCurrency(1234.56, {
214
+ useBanglaDigits: false,
215
+ symbol: true
216
+ }); // "ā§ŗ1,234.56"
217
+ ```
218
+
219
+ #### `parseCurrency(currencyString: string): number`
220
+ Parses a Bengali currency string to a number.
221
+
222
+ ```typescript
223
+ parseCurrency("ā§§,ā§Ģā§Ļā§Ļ āϟāĻžāĻ•āĻž"); // 1500
224
+ parseCurrency("⧺⧍,ā§Ģā§Ļā§Ļ"); // 2500
225
+ parseCurrency("1,234.56"); // 1234.56
226
+ ```
227
+
228
+ #### Currency Math Operations
229
+
230
+ ```typescript
231
+ import { addCurrency, subtractCurrency, multiplyCurrency, divideCurrency } from 'bangla-stdlib';
232
+
233
+ addCurrency(100.50, 200.75); // 301.25
234
+ subtractCurrency(500, 150.25); // 349.75
235
+ multiplyCurrency(100, 1.5); // 150.00
236
+ divideCurrency(300, 3); // 100.00
237
+ ```
238
+
239
+ #### Tax and Discount Calculations
240
+
241
+ ```typescript
242
+ import { calculateTax, applyDiscount } from 'bangla-stdlib';
243
+
244
+ calculateTax(1000, 15); // 150 (15% tax)
245
+ applyDiscount(1000, 10); // 900 (10% discount applied)
246
+ ```
247
+
248
+ ### Bengali Calendar
249
+
250
+ #### `toBengali(date: Date): { year: number; month: number; day: number }`
251
+ Converts a Gregorian date to Bengali calendar.
252
+
253
+ ```typescript
254
+ toBengali(new Date(2024, 3, 14));
255
+ // { year: 1431, month: 1, day: 1 } - Pohela Boishakh
256
+ ```
257
+
258
+ #### `fromBengali(bengaliDate): Date`
259
+ Converts a Bengali calendar date to Gregorian.
260
+
261
+ ```typescript
262
+ fromBengali({ year: 1431, month: 1, day: 1 });
263
+ // Date object for April 14, 2024
264
+ ```
265
+
266
+ #### `getBengaliDate(date: Date, options?): string`
267
+ Formats a date as Bengali calendar with Bengali text.
268
+
269
+ ```typescript
270
+ getBengaliDate(new Date(), { includeWeekday: true });
271
+ // "āĻŽāĻ™ā§āĻ—āϞāĻŦāĻžāϰ ⧍ā§Ē āĻĒ⧌āώ ā§§ā§Ēā§Šā§§"
272
+ ```
273
+
274
+ #### Date Arithmetic
275
+
276
+ ```typescript
277
+ import { addDaysToBengaliDate, getBengaliDateDifference } from 'bangla-stdlib';
278
+
279
+ addDaysToBengaliDate({ year: 1431, month: 1, day: 1 }, 10);
280
+ // { year: 1431, month: 1, day: 11 }
281
+
282
+ getBengaliDateDifference(
283
+ { year: 1431, month: 1, day: 1 },
284
+ { year: 1431, month: 1, day: 10 }
285
+ ); // 9 days
286
+ ```
287
+
288
+ ### Date Formatting
289
+
290
+ #### `formatDate(date: Date, options?): string`
291
+ Formats a date with Bengali digits and month names.
292
+
293
+ ```typescript
294
+ formatDate(new Date(2024, 0, 15)); // "ā§§ā§Ģ āĻŦ⧈āĻļāĻžāĻ– ⧍ā§Ļ⧍ā§Ē"
295
+ formatDate(new Date(), { includeWeekday: true, includeYear: false });
296
+ // "āĻŽāĻ™ā§āĻ—āϞāĻŦāĻžāϰ ā§­ āĻĒ⧌āώ"
297
+ ```
298
+
299
+ #### `parseDate(dateString: string): Date`
300
+ Parses a Bengali date string to a Date object.
301
+
302
+ ```typescript
303
+ parseDate("ā§§ā§Ģ āĻŦ⧈āĻļāĻžāĻ– ā§§ā§Ēā§Šā§§"); // Date object
304
+ parseDate("ā§§ā§Ģ/ā§Ļā§Ē/⧍ā§Ļ⧍ā§Ē"); // Date object
305
+ parseDate("15-04-2024"); // Date object
306
+ ```
307
+
308
+ ### Months
309
+
310
+ #### `toBanglaMonth(monthNumber: number): string`
311
+ Converts a month number (1-12) to Bengali month name.
312
+
313
+ ```typescript
314
+ toBanglaMonth(1); // "āĻŦ⧈āĻļāĻžāĻ–"
315
+ toBanglaMonth(6); // "āφāĻļā§āĻŦāĻŋāύ"
316
+ toBanglaMonth(12); // "āϚ⧈āĻ¤ā§āϰ"
317
+ ```
318
+
319
+ #### `fromBanglaMonth(monthName: string): number`
320
+ Converts a Bengali month name to number.
321
+
322
+ ```typescript
323
+ fromBanglaMonth("āĻŦ⧈āĻļāĻžāĻ–"); // 1
324
+ fromBanglaMonth("āφāĻļā§āĻŦāĻŋāύ"); // 6
325
+ ```
326
+
327
+ #### `getMonthName(date: Date): string`
328
+ Gets the Bengali month name from a Date object.
329
+
330
+ ```typescript
331
+ getMonthName(new Date(2024, 0, 15)); // "āĻŦ⧈āĻļāĻžāĻ–"
332
+ ```
333
+
334
+ #### Month Navigation
335
+
336
+ ```typescript
337
+ import { getNextMonth, getPreviousMonth, getMonthRange } from 'bangla-stdlib';
338
+
339
+ getNextMonth(1); // 2
340
+ getNextMonth(12); // 1 (wraps around)
341
+ getNextMonth("āĻŦ⧈āĻļāĻžāĻ–"); // "āĻœā§āϝ⧈āĻˇā§āĻ "
342
+
343
+ getPreviousMonth(2); // 1
344
+ getPreviousMonth(1); // 12 (wraps around)
345
+
346
+ getMonthRange(1, 3); // [1, 2, 3]
347
+ getMonthRange("āĻŦ⧈āĻļāĻžāĻ–", "āφāώāĻžāĻĸāĻŧ"); // ["āĻŦ⧈āĻļāĻžāĻ–", "āĻœā§āϝ⧈āĻˇā§āĻ ", "āφāώāĻžāĻĸāĻŧ"]
348
+ ```
349
+
350
+ ### Weekdays
351
+
352
+ #### `getWeekdayName(date: Date): string`
353
+ Gets the Bengali weekday name from a Date object.
354
+
355
+ ```typescript
356
+ getWeekdayName(new Date()); // "āĻŽāĻ™ā§āĻ—āϞāĻŦāĻžāϰ"
357
+ ```
358
+
359
+ #### `toBanglaWeekday(dayNumber: number): string`
360
+ Converts a day number (0-6) to Bengali weekday name.
361
+
362
+ ```typescript
363
+ toBanglaWeekday(0); // "āϰāĻŦāĻŋāĻŦāĻžāϰ" (Sunday)
364
+ toBanglaWeekday(1); // "āϏ⧋āĻŽāĻŦāĻžāϰ" (Monday)
365
+ toBanglaWeekday(6); // "āĻļāύāĻŋāĻŦāĻžāϰ" (Saturday)
366
+ ```
367
+
368
+ #### `fromBanglaWeekday(weekdayName: string): number`
369
+ Converts a Bengali weekday name to number.
370
+
371
+ ```typescript
372
+ fromBanglaWeekday("āϰāĻŦāĻŋāĻŦāĻžāϰ"); // 0
373
+ fromBanglaWeekday("āϏ⧋āĻŽāĻŦāĻžāϰ"); // 1
374
+ ```
375
+
376
+ ### Seasons
377
+
378
+ #### `getSeason(date: Date): string`
379
+ Gets the Bengali season for a given date.
380
+
381
+ ```typescript
382
+ getSeason(new Date(2024, 0, 15)); // "āĻļā§€āϤ" (Winter)
383
+ getSeason(new Date(2024, 6, 15)); // "āĻŦāĻ°ā§āώāĻž" (Monsoon)
384
+ ```
385
+
386
+ #### `getSeasonName(seasonNumber: number): string`
387
+ Gets the Bengali season name by number (1-6).
388
+
389
+ ```typescript
390
+ getSeasonName(1); // "āĻ—ā§āϰ⧀āĻˇā§āĻŽ" (Summer)
391
+ getSeasonName(3); // "āĻŦāĻ°ā§āώāĻž" (Monsoon)
392
+ getSeasonName(5); // "āĻļā§€āϤ" (Winter)
393
+ ```
394
+
395
+ ### Time
396
+
397
+ #### `formatTime(date: Date, options?): string`
398
+ Formats time in Bengali with period names.
399
+
400
+ ```typescript
401
+ formatTime(new Date()); // "āϏāĻ•āĻžāϞ ā§§ā§Ļ:ā§Šā§Ļ"
402
+ formatTime(new Date(), { use24Hour: true }); // "ā§§ā§Ļ:ā§Šā§Ļ"
403
+ formatTime(new Date(), { showSeconds: true }); // "āϏāĻ•āĻžāϞ ā§§ā§Ļ:ā§Šā§Ļ:ā§§ā§Ģ"
404
+ ```
405
+
406
+ ### Ordinal Numbers
407
+
408
+ #### `toOrdinal(number: number): string`
409
+ Converts a number to Bengali ordinal.
410
+
411
+ ```typescript
412
+ toOrdinal(1); // "āĻĒā§āϰāĻĨāĻŽ"
413
+ toOrdinal(2); // "āĻĻā§āĻŦāĻŋāϤ⧀āϝāĻŧ"
414
+ toOrdinal(3); // "āϤ⧃āϤ⧀āϝāĻŧ"
415
+ toOrdinal(21); // "āĻāϕ⧁āĻļāϤāĻŽ"
416
+ toOrdinal(100); // "āĻļāϤāϤāĻŽ"
417
+ ```
418
+
419
+ ### Phone Numbers
420
+
421
+ #### `validatePhone(phoneNumber: string): boolean`
422
+ Validates a Bangladeshi phone number.
423
+
424
+ ```typescript
425
+ validatePhone("01712345678"); // true
426
+ validatePhone("01812345678"); // true
427
+ validatePhone("1234567890"); // false
428
+ ```
429
+
430
+ #### `formatPhone(phoneNumber: string, options?): string`
431
+ Formats a phone number with customizable options.
432
+
433
+ ```typescript
434
+ formatPhone("01712345678"); // "ā§Ļā§§ā§­ā§§-ā§¨ā§Šā§Ēā§Ģā§Ŧā§­ā§Ž"
435
+ formatPhone("01712345678", { style: "spaced" }); // "ā§Ļā§§ā§­ā§§ ā§¨ā§Šā§Ē ā§Ģā§Ŧā§­ā§Ž"
436
+ formatPhone("01712345678", {
437
+ style: "compact",
438
+ includeCountryCode: true
439
+ }); // "+ā§Žā§Žā§Ļā§§ā§­ā§§ā§¨ā§Šā§Ēā§Ģā§Ŧā§­ā§Ž"
440
+ ```
441
+
442
+ #### `getOperator(phoneNumber: string): string | null`
443
+ Detects the mobile operator from a phone number.
444
+
445
+ ```typescript
446
+ getOperator("01712345678"); // "Grameenphone"
447
+ getOperator("01812345678"); // "Robi"
448
+ getOperator("01912345678"); // "Banglalink"
449
+ ```
450
+
451
+ ### Text Utilities
452
+
453
+ #### `validateBangla(text: string): boolean`
454
+ Validates if text contains only Bengali characters and whitespace.
455
+
456
+ ```typescript
457
+ validateBangla("āĻŦāĻžāĻ‚āϞāĻž"); // true
458
+ validateBangla("āĻŦāĻžāĻ‚āϞāĻž āĻ­āĻžāώāĻž"); // true
459
+ validateBangla("Hello āĻŦāĻžāĻ‚āϞāĻž"); // false
460
+ ```
461
+
462
+ #### `isBanglaText(text: string): boolean`
463
+ Checks if text contains any Bengali characters.
464
+
465
+ ```typescript
466
+ isBanglaText("āĻŦāĻžāĻ‚āϞāĻž"); // true
467
+ isBanglaText("Hello āĻŦāĻžāĻ‚āϞāĻž"); // true
468
+ isBanglaText("Hello"); // false
469
+ ```
470
+
471
+ #### `isBanglaDigit(char: string): boolean`
472
+ Checks if a character is a Bengali digit.
473
+
474
+ ```typescript
475
+ isBanglaDigit("ā§Ģ"); // true
476
+ isBanglaDigit("5"); // false
477
+ ```
478
+
479
+ #### Content Analysis
480
+
481
+ ```typescript
482
+ import {
483
+ countBengaliCharacters,
484
+ getBengaliPercentage,
485
+ extractBengaliChars,
486
+ splitBengaliContent
487
+ } from 'bangla-stdlib';
488
+
489
+ countBengaliCharacters("Hello āĻŦāĻžāĻ‚āϞāĻž"); // 5
490
+ getBengaliPercentage("Hello āĻŦāĻžāĻ‚āϞāĻž"); // 50
491
+ extractBengaliChars("Hello āĻŦāĻžāĻ‚āϞāĻž World"); // "āĻŦāĻžāĻ‚āϞāĻž"
492
+ splitBengaliContent("Hello āĻŦāĻžāĻ‚āϞāĻž");
493
+ // { bengali: "āĻŦāĻžāĻ‚āϞāĻž", nonBengali: "Hello" }
494
+ ```
495
+
496
+ ## Validation and Error Handling
497
+
498
+ All modules include comprehensive validation functions that don't throw errors, making them safe for UI contexts:
499
+
500
+ ```typescript
501
+ import {
502
+ isValidMonthNumber,
503
+ sanitizePhoneNumber,
504
+ isValidCurrency,
505
+ isValidDate,
506
+ isValidBengaliDate,
507
+ } from 'bangla-stdlib';
508
+
509
+ // Safe validation
510
+ if (isValidMonthNumber(13)) {
511
+ // Won't execute - 13 is invalid
512
+ }
513
+
514
+ // Sanitization with fallbacks
515
+ const phone = sanitizePhoneNumber(userInput); // Returns empty string if invalid
516
+ const amount = sanitizeCurrency(userInput); // Returns null if invalid
517
+ ```
518
+
519
+ ## Batch Operations
520
+
521
+ Process arrays efficiently:
522
+
523
+ ```typescript
524
+ import {
525
+ batchToBanglaNumber,
526
+ batchFormatCurrency,
527
+ batchToBanglaMonth,
528
+ } from 'bangla-stdlib';
529
+
530
+ batchToBanglaNumber([1, 2, 3, 4, 5]);
531
+ // ["ā§§", "⧍", "ā§Š", "ā§Ē", "ā§Ģ"]
532
+
533
+ batchFormatCurrency([100, 200, 300]);
534
+ // ["ā§§ā§Ļā§Ļ āϟāĻžāĻ•āĻž", "⧍ā§Ļā§Ļ āϟāĻžāĻ•āĻž", "ā§Šā§Ļā§Ļ āϟāĻžāĻ•āĻž"]
535
+
536
+ batchToBanglaMonth([1, 6, 12]);
537
+ // ["āĻŦ⧈āĻļāĻžāĻ–", "āφāĻļā§āĻŦāĻŋāύ", "āϚ⧈āĻ¤ā§āϰ"]
538
+ ```
539
+
540
+ ## TypeScript Support
541
+
542
+ Fully typed with TypeScript. All functions have comprehensive type definitions:
543
+
544
+ ```typescript
545
+ import type {
546
+ BengaliDate,
547
+ FormatCurrencyOptions,
548
+ FormatDateOptions,
549
+ FormatPhoneOptions,
550
+ } from 'bangla-stdlib';
551
+
552
+ const options: FormatCurrencyOptions = {
553
+ useBanglaDigits: true,
554
+ symbol: true,
555
+ word: false,
556
+ };
557
+
558
+ const bengaliDate: BengaliDate = {
559
+ year: 1431,
560
+ month: 1,
561
+ day: 1,
562
+ };
563
+ ```
564
+
565
+ ## Performance
566
+
567
+ - All functions are optimized for performance
568
+ - Zero runtime dependencies
569
+ - Tree-shakeable - only import what you need
570
+ - Suitable for high-frequency operations
571
+
572
+ ```typescript
573
+ // Performance benchmarks (1000 operations):
574
+ // - toBanglaNumber: ~0.75ms
575
+ // - formatCurrency: ~2.13ms
576
+ // - toBengali: ~1.5ms
577
+ // - formatDate: ~1.8ms
578
+ ```
579
+
580
+ ## Browser Support
581
+
582
+ Works in all modern browsers and Node.js environments:
583
+ - Chrome/Edge 90+
584
+ - Firefox 88+
585
+ - Safari 14+
586
+ - Node.js 14+
587
+
588
+ ## Development
589
+
590
+ ```bash
591
+ # Install dependencies
592
+ pnpm install
593
+
594
+ # Run tests
595
+ pnpm test
596
+
597
+ # Run tests in watch mode
598
+ pnpm test:watch
599
+
600
+ # Build
601
+ pnpm build
602
+
603
+ # Type check
604
+ pnpm typecheck
605
+
606
+ # Lint
607
+ pnpm lint
608
+ ```
609
+
610
+ ## Contributing
611
+
612
+ Contributions are welcome! Please read our contributing guidelines before submitting PRs.
613
+
614
+ ### Guidelines
615
+ - Follow Bangladesh standards precisely
616
+ - Maintain deterministic behavior
617
+ - Add comprehensive tests for new features
618
+ - Update documentation
619
+ - Ensure zero runtime dependencies
620
+
621
+ ## License
622
+
623
+ MIT Š Mahmudul Alam
624
+
625
+ ## Acknowledgments
626
+
627
+ Thanks to all contributors and the Bengali language community for their support in maintaining accurate standards.
628
+
629
+ ---
630
+
631
+ Made with â¤ī¸ for the Bengali-speaking community