dff-util 1.1.7 → 1.1.9
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 +296 -16
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/main/const-type.d.ts +40 -0
- package/dist/main/countries.d.ts +2 -0
- package/dist/main/countries.js +1955 -0
- package/dist/main/languages.d.ts +2 -0
- package/dist/main/languages.js +1669 -0
- package/dist/main/util.d.ts +4 -1
- package/dist/main/util.js +48 -6
- package/dist/tests/{lang.js → util.js} +18 -14
- package/package.json +1 -1
- /package/dist/main/{regexr.d.ts → reg-exr.d.ts} +0 -0
- /package/dist/main/{regexr.js → reg-exr.js} +0 -0
- /package/dist/tests/{lang.d.ts → util.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -243,10 +243,67 @@ ResponseType = {
|
|
|
243
243
|
status?: string | number;
|
|
244
244
|
data?: any;
|
|
245
245
|
error?: any;
|
|
246
|
+
total?: number;
|
|
246
247
|
};
|
|
247
248
|
|
|
248
249
|
```
|
|
249
250
|
|
|
251
|
+
## SearchByLimitType
|
|
252
|
+
```
|
|
253
|
+
export type SearchByLimitType = {
|
|
254
|
+
limit: number;
|
|
255
|
+
skip: number;
|
|
256
|
+
query?: Record<string, any>;
|
|
257
|
+
orderBy?: string;
|
|
258
|
+
order: "ASC" | "DESC";
|
|
259
|
+
};
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## CountryType
|
|
263
|
+
```
|
|
264
|
+
export type CountryType = {
|
|
265
|
+
code: string; // ISO 3166-1 alpha-2
|
|
266
|
+
name: string; // English country name
|
|
267
|
+
locale: string; // Native/local language name
|
|
268
|
+
googleNames: string[]; // Common names
|
|
269
|
+
currencyCode: string; // ISO 4217 currency code
|
|
270
|
+
currency: string; // Currency symbol
|
|
271
|
+
telCode: number; // Numeric only (no +)
|
|
272
|
+
flag: string; // Emoji flag
|
|
273
|
+
};
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## LangDirType, OrderType
|
|
277
|
+
```
|
|
278
|
+
export type LangDirType = "ltr" | "rtl";
|
|
279
|
+
export type OrderType = "ASC" | "DESC";
|
|
280
|
+
```
|
|
281
|
+
## LanguageType
|
|
282
|
+
```
|
|
283
|
+
export type LanguageType = {
|
|
284
|
+
lang: string; // Locale code (e.g., en-US, hi-IN)
|
|
285
|
+
code: string; // ISO 639-1 language code (e.g., en, hi)
|
|
286
|
+
country: string; // ISO 3166-1 alpha-2 country code (e.g., US, IN)
|
|
287
|
+
name: string; // English name of the language
|
|
288
|
+
dir: "ltr" | "rtl"; // Text direction
|
|
289
|
+
locale: string; // Native name of the language
|
|
290
|
+
};
|
|
291
|
+
```
|
|
292
|
+
## LangCountryType
|
|
293
|
+
```
|
|
294
|
+
export type LangCountryType = {
|
|
295
|
+
lang: string; // Locale code (e.g., en-US, hi-IN)
|
|
296
|
+
country: string; // ISO 3166-1 alpha-2 country code (e.g., US, IN)
|
|
297
|
+
name: string; // English name of the language
|
|
298
|
+
locale: string; // Native name of the language
|
|
299
|
+
currencyCode: string; // ISO 4217 currency code
|
|
300
|
+
currency: string; // Currency symbol
|
|
301
|
+
telCode: number; // Numeric only (no +)
|
|
302
|
+
flag: string; // Emoji flag
|
|
303
|
+
dir: "ltr" | "rtl"; // Text direction
|
|
304
|
+
};
|
|
305
|
+
```
|
|
306
|
+
|
|
250
307
|
## ConstMessages
|
|
251
308
|
|
|
252
309
|
```
|
|
@@ -453,31 +510,254 @@ const main = async () => {
|
|
|
453
510
|
};
|
|
454
511
|
|
|
455
512
|
main();
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
456
516
|
```
|
|
457
517
|
|
|
458
|
-
###
|
|
518
|
+
### Call LangText, CallLangCountry, CurrencyConvert,
|
|
459
519
|
```
|
|
460
|
-
// bun run src/tests/
|
|
461
|
-
import { LangData } from "../main/util";
|
|
520
|
+
// bun run src/tests/util.ts
|
|
462
521
|
|
|
463
|
-
|
|
464
|
-
try {
|
|
465
|
-
const resp = await LangData("Hello, how are you?", "en-US", "ka-IN");
|
|
466
|
-
console.log("Resp Kannada:: ", resp);
|
|
522
|
+
import { CurrencyConvert, LangCountryCode } from "../main/util";
|
|
467
523
|
|
|
468
|
-
|
|
469
|
-
|
|
524
|
+
const CallLangCountry = () => {
|
|
525
|
+
const lang = "en-US";
|
|
526
|
+
const country = LangCountryCode(lang);
|
|
527
|
+
console.log("LangCountryCode:: ", country);
|
|
528
|
+
};
|
|
470
529
|
|
|
471
|
-
|
|
472
|
-
|
|
530
|
+
const CallLangText = async () => {
|
|
531
|
+
const resp = await LangText("Hello, how are you?", "en-US", "te-IN");
|
|
532
|
+
console.log("Resp Kannada:: ", resp);
|
|
533
|
+
}
|
|
473
534
|
|
|
474
|
-
|
|
475
|
-
|
|
535
|
+
const CallCurrencyConvert = async () => {
|
|
536
|
+
const resp = await CurrencyConvert("INR", "USD");
|
|
537
|
+
console.log("Resp Currency:: ", resp);
|
|
538
|
+
}
|
|
476
539
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
540
|
+
import { LangText } from "../main/util";
|
|
541
|
+
|
|
542
|
+
const run = async () => {
|
|
543
|
+
await CallLangCountry();
|
|
544
|
+
await CallLangText();
|
|
545
|
+
await CallCurrencyConvert();
|
|
480
546
|
};
|
|
481
547
|
|
|
482
548
|
run();
|
|
549
|
+
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Type AllLanguageCodesType
|
|
553
|
+
```
|
|
554
|
+
export type AllLanguageCodesType =
|
|
555
|
+
| "ps-AF"
|
|
556
|
+
| "sq-AL"
|
|
557
|
+
| "ar-DZ"
|
|
558
|
+
| "ca-AD"
|
|
559
|
+
| "pt-AO"
|
|
560
|
+
| "en-AG"
|
|
561
|
+
| "es-AR"
|
|
562
|
+
| "hy-AM"
|
|
563
|
+
| "en-AU"
|
|
564
|
+
| "de-AT"
|
|
565
|
+
| "az-AZ"
|
|
566
|
+
| "en-BS"
|
|
567
|
+
| "ar-BH"
|
|
568
|
+
| "bn-BD"
|
|
569
|
+
| "en-BB"
|
|
570
|
+
| "be-BY"
|
|
571
|
+
| "nl-BE"
|
|
572
|
+
| "en-BZ"
|
|
573
|
+
| "fr-BJ"
|
|
574
|
+
| "dz-BT"
|
|
575
|
+
| "es-BO"
|
|
576
|
+
| "bs-BA"
|
|
577
|
+
| "en-BW"
|
|
578
|
+
| "pt-BR"
|
|
579
|
+
| "ms-BN"
|
|
580
|
+
| "bg-BG"
|
|
581
|
+
| "fr-BF"
|
|
582
|
+
| "rn-BI"
|
|
583
|
+
| "pt-CV"
|
|
584
|
+
| "km-KH"
|
|
585
|
+
| "fr-CM"
|
|
586
|
+
| "en-CA"
|
|
587
|
+
| "fr-CF"
|
|
588
|
+
| "fr-TD"
|
|
589
|
+
| "es-CL"
|
|
590
|
+
| "zh-CN"
|
|
591
|
+
| "es-CO"
|
|
592
|
+
| "ar-KM"
|
|
593
|
+
| "fr-CG"
|
|
594
|
+
| "fr-CD"
|
|
595
|
+
| "es-CR"
|
|
596
|
+
| "fr-CI"
|
|
597
|
+
| "hr-HR"
|
|
598
|
+
| "es-CU"
|
|
599
|
+
| "el-CY"
|
|
600
|
+
| "cs-CZ"
|
|
601
|
+
| "da-DK"
|
|
602
|
+
| "fr-DJ"
|
|
603
|
+
| "en-DM"
|
|
604
|
+
| "es-DO"
|
|
605
|
+
| "es-EC"
|
|
606
|
+
| "ar-EG"
|
|
607
|
+
| "es-SV"
|
|
608
|
+
| "es-GQ"
|
|
609
|
+
| "ti-ER"
|
|
610
|
+
| "et-EE"
|
|
611
|
+
| "si-SZ"
|
|
612
|
+
| "am-ET"
|
|
613
|
+
| "en-FJ"
|
|
614
|
+
| "fi-FI"
|
|
615
|
+
| "fr-FR"
|
|
616
|
+
| "fr-GA"
|
|
617
|
+
| "en-GM"
|
|
618
|
+
| "ka-GE"
|
|
619
|
+
| "de-DE"
|
|
620
|
+
| "en-GH"
|
|
621
|
+
| "el-GR"
|
|
622
|
+
| "en-GD"
|
|
623
|
+
| "es-GT"
|
|
624
|
+
| "fr-GN"
|
|
625
|
+
| "pt-GW"
|
|
626
|
+
| "en-GY"
|
|
627
|
+
| "fr-HT"
|
|
628
|
+
| "es-HN"
|
|
629
|
+
| "hu-HU"
|
|
630
|
+
| "is-IS"
|
|
631
|
+
| "hi-IN"
|
|
632
|
+
| "kn-IN"
|
|
633
|
+
| "ta-IN"
|
|
634
|
+
| "te-IN"
|
|
635
|
+
| "bn-IN"
|
|
636
|
+
| "mr-IN"
|
|
637
|
+
| "gu-IN"
|
|
638
|
+
| "ml-IN"
|
|
639
|
+
| "pa-IN"
|
|
640
|
+
| "or-IN"
|
|
641
|
+
| "as-IN"
|
|
642
|
+
| "id-ID"
|
|
643
|
+
| "fa-IR"
|
|
644
|
+
| "ar-IQ"
|
|
645
|
+
| "ga-IE"
|
|
646
|
+
| "he-IL"
|
|
647
|
+
| "it-IT"
|
|
648
|
+
| "en-JM"
|
|
649
|
+
| "ja-JP"
|
|
650
|
+
| "ar-JO"
|
|
651
|
+
| "kk-KZ"
|
|
652
|
+
| "sw-KE"
|
|
653
|
+
| "en-KI"
|
|
654
|
+
| "ko-KP"
|
|
655
|
+
| "ko-KR"
|
|
656
|
+
| "ar-KW"
|
|
657
|
+
| "ky-KG"
|
|
658
|
+
| "lo-LA"
|
|
659
|
+
| "lv-LV"
|
|
660
|
+
| "ar-LB"
|
|
661
|
+
| "st-LS"
|
|
662
|
+
| "en-LR"
|
|
663
|
+
| "ar-LY"
|
|
664
|
+
| "de-LI"
|
|
665
|
+
| "lt-LT"
|
|
666
|
+
| "fr-LU"
|
|
667
|
+
| "mg-MG"
|
|
668
|
+
| "ny-MW"
|
|
669
|
+
| "ms-MY"
|
|
670
|
+
| "dv-MV"
|
|
671
|
+
| "fr-ML"
|
|
672
|
+
| "mt-MT"
|
|
673
|
+
| "en-MH"
|
|
674
|
+
| "ar-MR"
|
|
675
|
+
| "en-MU"
|
|
676
|
+
| "es-MX"
|
|
677
|
+
| "en-FM"
|
|
678
|
+
| "ro-MD"
|
|
679
|
+
| "fr-MC"
|
|
680
|
+
| "mn-MN"
|
|
681
|
+
| "sr-ME"
|
|
682
|
+
| "ar-MA"
|
|
683
|
+
| "pt-MZ"
|
|
684
|
+
| "my-MM"
|
|
685
|
+
| "en-NA"
|
|
686
|
+
| "en-NR"
|
|
687
|
+
| "ne-NP"
|
|
688
|
+
| "nl-NL"
|
|
689
|
+
| "en-NZ"
|
|
690
|
+
| "es-NI"
|
|
691
|
+
| "fr-NE"
|
|
692
|
+
| "en-NG"
|
|
693
|
+
| "yo-NG"
|
|
694
|
+
| "ha-NG"
|
|
695
|
+
| "ig-NG"
|
|
696
|
+
| "en-NU"
|
|
697
|
+
| "nb-NO"
|
|
698
|
+
| "ar-OM"
|
|
699
|
+
| "ur-PK"
|
|
700
|
+
| "en-PW"
|
|
701
|
+
| "ar-PS"
|
|
702
|
+
| "es-PA"
|
|
703
|
+
| "en-PG"
|
|
704
|
+
| "es-PY"
|
|
705
|
+
| "es-PE"
|
|
706
|
+
| "tl-PH"
|
|
707
|
+
| "pl-PL"
|
|
708
|
+
| "pt-PT"
|
|
709
|
+
| "ar-QA"
|
|
710
|
+
| "ro-RO"
|
|
711
|
+
| "ru-RU"
|
|
712
|
+
| "rw-RW"
|
|
713
|
+
| "en-KN"
|
|
714
|
+
| "en-LC"
|
|
715
|
+
| "en-VC"
|
|
716
|
+
| "sm-WS"
|
|
717
|
+
| "it-SM"
|
|
718
|
+
| "pt-ST"
|
|
719
|
+
| "ar-SA"
|
|
720
|
+
| "fr-SN"
|
|
721
|
+
| "sr-RS"
|
|
722
|
+
| "en-SC"
|
|
723
|
+
| "en-SL"
|
|
724
|
+
| "en-SG"
|
|
725
|
+
| "sk-SK"
|
|
726
|
+
| "sl-SI"
|
|
727
|
+
| "en-SB"
|
|
728
|
+
| "so-SO"
|
|
729
|
+
| "af-ZA"
|
|
730
|
+
| "en-SS"
|
|
731
|
+
| "es-ES"
|
|
732
|
+
| "si-LK"
|
|
733
|
+
| "ar-SD"
|
|
734
|
+
| "nl-SR"
|
|
735
|
+
| "sv-SE"
|
|
736
|
+
| "de-CH"
|
|
737
|
+
| "ar-SY"
|
|
738
|
+
| "tg-TJ"
|
|
739
|
+
| "sw-TZ"
|
|
740
|
+
| "th-TH"
|
|
741
|
+
| "pt-TL"
|
|
742
|
+
| "fr-TG"
|
|
743
|
+
| "to-TO"
|
|
744
|
+
| "en-TT"
|
|
745
|
+
| "ar-TN"
|
|
746
|
+
| "tr-TR"
|
|
747
|
+
| "tk-TM"
|
|
748
|
+
| "en-TV"
|
|
749
|
+
| "en-UG"
|
|
750
|
+
| "uk-UA"
|
|
751
|
+
| "ar-AE"
|
|
752
|
+
| "en-GB"
|
|
753
|
+
| "en-US"
|
|
754
|
+
| "es-UY"
|
|
755
|
+
| "uz-UZ"
|
|
756
|
+
| "bi-VU"
|
|
757
|
+
| "it-VA"
|
|
758
|
+
| "es-VE"
|
|
759
|
+
| "vi-VN"
|
|
760
|
+
| "ar-YE"
|
|
761
|
+
| "en-ZM"
|
|
762
|
+
| "en-ZW";
|
|
483
763
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './main/util';
|
|
2
2
|
export * from './main/jwt-util';
|
|
3
3
|
export * from './main/http';
|
|
4
|
-
export * from './main/
|
|
4
|
+
export * from './main/reg-exr';
|
|
5
5
|
export * from './main/const-value';
|
|
6
6
|
export * from './main/const-type';
|
|
7
7
|
export * from './main/const-messages';
|
|
8
|
+
export * from './main/countries';
|
|
9
|
+
export * from './main/languages';
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./main/util"), exports);
|
|
18
18
|
__exportStar(require("./main/jwt-util"), exports);
|
|
19
19
|
__exportStar(require("./main/http"), exports);
|
|
20
|
-
__exportStar(require("./main/
|
|
20
|
+
__exportStar(require("./main/reg-exr"), exports);
|
|
21
21
|
__exportStar(require("./main/const-value"), exports);
|
|
22
22
|
__exportStar(require("./main/const-type"), exports);
|
|
23
23
|
__exportStar(require("./main/const-messages"), exports);
|
|
24
|
+
__exportStar(require("./main/countries"), exports);
|
|
25
|
+
__exportStar(require("./main/languages"), exports);
|
|
@@ -23,4 +23,44 @@ export type ResponseType = {
|
|
|
23
23
|
status?: string | number;
|
|
24
24
|
data?: any;
|
|
25
25
|
error?: any;
|
|
26
|
+
total?: number;
|
|
26
27
|
};
|
|
28
|
+
export type SearchByLimitType = {
|
|
29
|
+
limit: number;
|
|
30
|
+
skip: number;
|
|
31
|
+
query?: Record<string, any>;
|
|
32
|
+
orderBy?: string;
|
|
33
|
+
order: "ASC" | "DESC";
|
|
34
|
+
};
|
|
35
|
+
export type CountryType = {
|
|
36
|
+
code: string;
|
|
37
|
+
name: string;
|
|
38
|
+
locale: string;
|
|
39
|
+
googleNames: string[];
|
|
40
|
+
currencyCode: string;
|
|
41
|
+
currency: string;
|
|
42
|
+
telCode: number;
|
|
43
|
+
flag: string;
|
|
44
|
+
};
|
|
45
|
+
export type LangDirType = "ltr" | "rtl";
|
|
46
|
+
export type OrderType = "ASC" | "DESC";
|
|
47
|
+
export type LanguageType = {
|
|
48
|
+
lang: string;
|
|
49
|
+
code: string;
|
|
50
|
+
country: string;
|
|
51
|
+
name: string;
|
|
52
|
+
dir: "ltr" | "rtl";
|
|
53
|
+
locale: string;
|
|
54
|
+
};
|
|
55
|
+
export type LangCountryType = {
|
|
56
|
+
lang: string;
|
|
57
|
+
country: string;
|
|
58
|
+
name: string;
|
|
59
|
+
locale: string;
|
|
60
|
+
currencyCode: string;
|
|
61
|
+
currency: string;
|
|
62
|
+
telCode: number;
|
|
63
|
+
flag: string;
|
|
64
|
+
dir: "ltr" | "rtl";
|
|
65
|
+
};
|
|
66
|
+
export type AllLanguageCodesType = "ps-AF" | "sq-AL" | "ar-DZ" | "ca-AD" | "pt-AO" | "en-AG" | "es-AR" | "hy-AM" | "en-AU" | "de-AT" | "az-AZ" | "en-BS" | "ar-BH" | "bn-BD" | "en-BB" | "be-BY" | "nl-BE" | "en-BZ" | "fr-BJ" | "dz-BT" | "es-BO" | "bs-BA" | "en-BW" | "pt-BR" | "ms-BN" | "bg-BG" | "fr-BF" | "rn-BI" | "pt-CV" | "km-KH" | "fr-CM" | "en-CA" | "fr-CF" | "fr-TD" | "es-CL" | "zh-CN" | "es-CO" | "ar-KM" | "fr-CG" | "fr-CD" | "es-CR" | "fr-CI" | "hr-HR" | "es-CU" | "el-CY" | "cs-CZ" | "da-DK" | "fr-DJ" | "en-DM" | "es-DO" | "es-EC" | "ar-EG" | "es-SV" | "es-GQ" | "ti-ER" | "et-EE" | "si-SZ" | "am-ET" | "en-FJ" | "fi-FI" | "fr-FR" | "fr-GA" | "en-GM" | "ka-GE" | "de-DE" | "en-GH" | "el-GR" | "en-GD" | "es-GT" | "fr-GN" | "pt-GW" | "en-GY" | "fr-HT" | "es-HN" | "hu-HU" | "is-IS" | "hi-IN" | "kn-IN" | "ta-IN" | "te-IN" | "bn-IN" | "mr-IN" | "gu-IN" | "ml-IN" | "pa-IN" | "or-IN" | "as-IN" | "id-ID" | "fa-IR" | "ar-IQ" | "ga-IE" | "he-IL" | "it-IT" | "en-JM" | "ja-JP" | "ar-JO" | "kk-KZ" | "sw-KE" | "en-KI" | "ko-KP" | "ko-KR" | "ar-KW" | "ky-KG" | "lo-LA" | "lv-LV" | "ar-LB" | "st-LS" | "en-LR" | "ar-LY" | "de-LI" | "lt-LT" | "fr-LU" | "mg-MG" | "ny-MW" | "ms-MY" | "dv-MV" | "fr-ML" | "mt-MT" | "en-MH" | "ar-MR" | "en-MU" | "es-MX" | "en-FM" | "ro-MD" | "fr-MC" | "mn-MN" | "sr-ME" | "ar-MA" | "pt-MZ" | "my-MM" | "en-NA" | "en-NR" | "ne-NP" | "nl-NL" | "en-NZ" | "es-NI" | "fr-NE" | "en-NG" | "yo-NG" | "ha-NG" | "ig-NG" | "en-NU" | "nb-NO" | "ar-OM" | "ur-PK" | "en-PW" | "ar-PS" | "es-PA" | "en-PG" | "es-PY" | "es-PE" | "tl-PH" | "pl-PL" | "pt-PT" | "ar-QA" | "ro-RO" | "ru-RU" | "rw-RW" | "en-KN" | "en-LC" | "en-VC" | "sm-WS" | "it-SM" | "pt-ST" | "ar-SA" | "fr-SN" | "sr-RS" | "en-SC" | "en-SL" | "en-SG" | "sk-SK" | "sl-SI" | "en-SB" | "so-SO" | "af-ZA" | "en-SS" | "es-ES" | "si-LK" | "ar-SD" | "nl-SR" | "sv-SE" | "de-CH" | "ar-SY" | "tg-TJ" | "sw-TZ" | "th-TH" | "pt-TL" | "fr-TG" | "to-TO" | "en-TT" | "ar-TN" | "tr-TR" | "tk-TM" | "en-TV" | "en-UG" | "uk-UA" | "ar-AE" | "en-GB" | "en-US" | "es-UY" | "uz-UZ" | "bi-VU" | "it-VA" | "es-VE" | "vi-VN" | "ar-YE" | "en-ZM" | "en-ZW";
|