ts-client-lib 0.0.7

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.
Files changed (64) hide show
  1. package/README.md +76 -0
  2. package/auth/TSJWT.d.ts +29 -0
  3. package/auth/TSJWT.js +44 -0
  4. package/auth/TSOAuth.d.ts +132 -0
  5. package/auth/TSOAuth.js +230 -0
  6. package/devices/TSCordova.d.ts +5 -0
  7. package/devices/TSCordova.js +52 -0
  8. package/entities/TSCountries.d.ts +14 -0
  9. package/entities/TSCountries.js +1188 -0
  10. package/entities/TSCurrencies.d.ts +35 -0
  11. package/entities/TSCurrencies.js +604 -0
  12. package/entities/TSMobilePhones.d.ts +167 -0
  13. package/entities/TSMobilePhones.js +206 -0
  14. package/entities/TSMoney.d.ts +149 -0
  15. package/entities/TSMoney.js +311 -0
  16. package/entities/currency-amount.d.ts +13 -0
  17. package/entities/currency-amount.js +43 -0
  18. package/finance/TSBonus.d.ts +197 -0
  19. package/finance/TSBonus.js +530 -0
  20. package/finance/TSKYC.d.ts +563 -0
  21. package/finance/TSKYC.js +1066 -0
  22. package/finance/TSTax.d.ts +49 -0
  23. package/finance/TSTax.js +106 -0
  24. package/finance/bonus-money.d.ts +41 -0
  25. package/finance/bonus-money.js +61 -0
  26. package/games/TSBetSlip.d.ts +72 -0
  27. package/games/TSBetSlip.js +179 -0
  28. package/games/TSBetSystem.d.ts +4 -0
  29. package/games/TSBetSystem.js +48 -0
  30. package/games/TSLotto.d.ts +35 -0
  31. package/games/TSLotto.js +205 -0
  32. package/games/TSPool.d.ts +28 -0
  33. package/games/TSPool.js +88 -0
  34. package/package.json +93 -0
  35. package/utils/TSArray.d.ts +9 -0
  36. package/utils/TSArray.js +87 -0
  37. package/utils/TSBoolean.d.ts +4 -0
  38. package/utils/TSBoolean.js +24 -0
  39. package/utils/TSCache.d.ts +167 -0
  40. package/utils/TSCache.js +531 -0
  41. package/utils/TSDate.d.ts +8 -0
  42. package/utils/TSDate.js +67 -0
  43. package/utils/TSHeuristic.d.ts +20 -0
  44. package/utils/TSHeuristic.js +197 -0
  45. package/utils/TSLZS.d.ts +42 -0
  46. package/utils/TSLZS.js +343 -0
  47. package/utils/TSLog.d.ts +40 -0
  48. package/utils/TSLog.js +110 -0
  49. package/utils/TSNumber.d.ts +6 -0
  50. package/utils/TSNumber.js +68 -0
  51. package/utils/TSObject.d.ts +29 -0
  52. package/utils/TSObject.js +312 -0
  53. package/utils/TSPagination.d.ts +282 -0
  54. package/utils/TSPagination.js +425 -0
  55. package/utils/TSPaginationMulti.d.ts +77 -0
  56. package/utils/TSPaginationMulti.js +356 -0
  57. package/utils/TSString.d.ts +10 -0
  58. package/utils/TSString.js +107 -0
  59. package/utils/TSValidator.d.ts +16 -0
  60. package/utils/TSValidator.js +74 -0
  61. package/utils/TSWorker.d.ts +3 -0
  62. package/utils/TSWorker.js +32 -0
  63. package/utils/diacritics-removal-map.d.ts +5 -0
  64. package/utils/diacritics-removal-map.js +341 -0
@@ -0,0 +1,167 @@
1
+ export declare class TSMobilePhones {
2
+ static phones: {
3
+ 'am-AM': RegExp;
4
+ 'ar-AE': RegExp;
5
+ 'ar-BH': RegExp;
6
+ 'ar-DZ': RegExp;
7
+ 'ar-LB': RegExp;
8
+ 'ar-EG': RegExp;
9
+ 'ar-IQ': RegExp;
10
+ 'ar-JO': RegExp;
11
+ 'ar-KW': RegExp;
12
+ 'ar-LY': RegExp;
13
+ 'ar-MA': RegExp;
14
+ 'ar-OM': RegExp;
15
+ 'ar-PS': RegExp;
16
+ 'ar-SA': RegExp;
17
+ 'ar-SY': RegExp;
18
+ 'ar-TN': RegExp;
19
+ 'az-AZ': RegExp;
20
+ 'bs-BA': RegExp;
21
+ 'be-BY': RegExp;
22
+ 'bg-BG': RegExp;
23
+ 'bn-BD': RegExp;
24
+ 'ca-AD': RegExp;
25
+ 'cs-CZ': RegExp;
26
+ 'da-DK': RegExp;
27
+ 'de-DE': RegExp;
28
+ 'de-AT': RegExp;
29
+ 'de-CH': RegExp;
30
+ 'de-LU': RegExp;
31
+ 'dv-MV': RegExp;
32
+ 'el-GR': RegExp;
33
+ 'el-CY': RegExp;
34
+ 'en-AI': RegExp;
35
+ 'en-AU': RegExp;
36
+ 'en-AG': RegExp;
37
+ 'en-BM': RegExp;
38
+ 'en-BS': RegExp;
39
+ 'en-GB': RegExp;
40
+ 'en-GG': RegExp;
41
+ 'en-GH': RegExp;
42
+ 'en-GY': RegExp;
43
+ 'en-HK': RegExp;
44
+ 'en-MO': RegExp;
45
+ 'en-IE': RegExp;
46
+ 'en-IN': RegExp;
47
+ 'en-JM': RegExp;
48
+ 'en-KE': RegExp;
49
+ 'en-SS': RegExp;
50
+ 'en-KI': RegExp;
51
+ 'en-KN': RegExp;
52
+ 'en-LS': RegExp;
53
+ 'en-MT': RegExp;
54
+ 'en-MU': RegExp;
55
+ 'en-NA': RegExp;
56
+ 'en-NG': RegExp;
57
+ 'en-NZ': RegExp;
58
+ 'en-PG': RegExp;
59
+ 'en-PK': RegExp;
60
+ 'en-PH': RegExp;
61
+ 'en-RW': RegExp;
62
+ 'en-SG': RegExp;
63
+ 'en-SL': RegExp;
64
+ 'en-TZ': RegExp;
65
+ 'en-UG': RegExp;
66
+ 'en-US': RegExp;
67
+ 'en-ZA': RegExp;
68
+ 'en-ZM': RegExp;
69
+ 'en-ZW': RegExp;
70
+ 'en-BW': RegExp;
71
+ 'es-AR': RegExp;
72
+ 'es-BO': RegExp;
73
+ 'es-CO': RegExp;
74
+ 'es-CL': RegExp;
75
+ 'es-CR': RegExp;
76
+ 'es-CU': RegExp;
77
+ 'es-DO': RegExp;
78
+ 'es-HN': RegExp;
79
+ 'es-EC': RegExp;
80
+ 'es-ES': RegExp;
81
+ 'es-PE': RegExp;
82
+ 'es-MX': RegExp;
83
+ 'es-NI': RegExp;
84
+ 'es-PA': RegExp;
85
+ 'es-PY': RegExp;
86
+ 'es-SV': RegExp;
87
+ 'es-UY': RegExp;
88
+ 'es-VE': RegExp;
89
+ 'et-EE': RegExp;
90
+ 'fa-IR': RegExp;
91
+ 'fi-FI': RegExp;
92
+ 'fj-FJ': RegExp;
93
+ 'fo-FO': RegExp;
94
+ 'fr-BF': RegExp;
95
+ 'fr-BJ': RegExp;
96
+ 'fr-CD': RegExp;
97
+ 'fr-CM': RegExp;
98
+ 'fr-FR': RegExp;
99
+ 'fr-GF': RegExp;
100
+ 'fr-GP': RegExp;
101
+ 'fr-MQ': RegExp;
102
+ 'fr-PF': RegExp;
103
+ 'fr-RE': RegExp;
104
+ 'he-IL': RegExp;
105
+ 'hu-HU': RegExp;
106
+ 'id-ID': RegExp;
107
+ 'ir-IR': RegExp;
108
+ 'it-IT': RegExp;
109
+ 'it-SM': RegExp;
110
+ 'ja-JP': RegExp;
111
+ 'ka-GE': RegExp;
112
+ 'kk-KZ': RegExp;
113
+ 'kl-GL': RegExp;
114
+ 'ko-KR': RegExp;
115
+ 'ky-KG': RegExp;
116
+ 'lt-LT': RegExp;
117
+ 'lv-LV': RegExp;
118
+ 'mg-MG': RegExp;
119
+ 'mn-MN': RegExp;
120
+ 'my-MM': RegExp;
121
+ 'ms-MY': RegExp;
122
+ 'mz-MZ': RegExp;
123
+ 'nb-NO': RegExp;
124
+ 'ne-NP': RegExp;
125
+ 'nl-BE': RegExp;
126
+ 'nl-NL': RegExp;
127
+ 'nl-AW': RegExp;
128
+ 'nn-NO': RegExp;
129
+ 'pl-PL': RegExp;
130
+ 'pt-BR': RegExp;
131
+ 'pt-PT': RegExp;
132
+ 'pt-AO': RegExp;
133
+ 'ro-MD': RegExp;
134
+ 'ro-RO': RegExp;
135
+ 'ru-RU': RegExp;
136
+ 'si-LK': RegExp;
137
+ 'sl-SI': RegExp;
138
+ 'sk-SK': RegExp;
139
+ 'sq-AL': RegExp;
140
+ 'sr-RS': RegExp;
141
+ 'sv-SE': RegExp;
142
+ 'tg-TJ': RegExp;
143
+ 'th-TH': RegExp;
144
+ 'tr-TR': RegExp;
145
+ 'tk-TM': RegExp;
146
+ 'uk-UA': RegExp;
147
+ 'uz-UZ': RegExp;
148
+ 'vi-VN': RegExp;
149
+ 'zh-CN': RegExp;
150
+ 'zh-TW': RegExp;
151
+ 'dz-BT': RegExp;
152
+ 'ar-YE': RegExp;
153
+ 'ar-EH': RegExp;
154
+ 'fa-AF': RegExp;
155
+ 'en-CA': string;
156
+ 'fr-CA': string;
157
+ 'fr-BE': string;
158
+ 'zh-HK': string;
159
+ 'zh-MO': string;
160
+ 'ga-IE': string;
161
+ 'fr-CH': string;
162
+ 'it-CH': string;
163
+ };
164
+ static is(str: string, locale: string | string[] | undefined, options?: {
165
+ strictMode?: boolean;
166
+ }): boolean;
167
+ }
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TSMobilePhones = void 0;
4
+ var TSMobilePhones = /** @class */ (function () {
5
+ function TSMobilePhones() {
6
+ }
7
+ TSMobilePhones.is = function (str, locale, options) {
8
+ if (options && options.strictMode && !str.startsWith('+')) {
9
+ return false;
10
+ }
11
+ if (Array.isArray(locale)) {
12
+ return locale.some(function (key) {
13
+ var k = key;
14
+ if (TSMobilePhones.phones[k]) {
15
+ var phone = TSMobilePhones.phones[k];
16
+ if (phone.test(str)) {
17
+ return true;
18
+ }
19
+ }
20
+ return false;
21
+ });
22
+ }
23
+ else if (locale && locale in TSMobilePhones.phones) {
24
+ return TSMobilePhones.phones[locale].test(str); // alias falsey locale as 'any'
25
+ }
26
+ else if (!locale || locale === 'any') {
27
+ for (var key in TSMobilePhones.phones) {
28
+ // istanbul ignore else
29
+ var k = key;
30
+ if (TSMobilePhones.phones[k]) {
31
+ var phone = TSMobilePhones.phones[k];
32
+ if (phone.test(str)) {
33
+ return true;
34
+ }
35
+ }
36
+ }
37
+ return false;
38
+ }
39
+ throw new Error("Invalid locale '".concat(String(locale), "'"));
40
+ };
41
+ TSMobilePhones.phones = {
42
+ 'am-AM': /^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/,
43
+ 'ar-AE': /^((\+?971)|0)?5[024568]\d{7}$/,
44
+ 'ar-BH': /^(\+?973)?(3|6)\d{7}$/,
45
+ 'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/,
46
+ 'ar-LB': /^(\+?961)?((3|81)\d{6}|7\d{7})$/,
47
+ 'ar-EG': /^((\+?20)|0)?1[0125]\d{8}$/,
48
+ 'ar-IQ': /^(\+?964|0)?7[0-9]\d{8}$/,
49
+ 'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
50
+ 'ar-KW': /^(\+?965)([569]\d{7}|41\d{6})$/,
51
+ 'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,
52
+ 'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/,
53
+ 'ar-OM': /^((\+|00)968)?(9[1-9])\d{6}$/,
54
+ 'ar-PS': /^(\+?970|0)5[6|9](\d{7})$/,
55
+ 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
56
+ 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
57
+ 'ar-TN': /^(\+?216)?[2459]\d{7}$/,
58
+ 'az-AZ': /^(\+994|0)(10|5[015]|7[07]|99)\d{7}$/,
59
+ 'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,
60
+ 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/,
61
+ 'bg-BG': /^(\+?359|0)?8[789]\d{7}$/,
62
+ 'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/,
63
+ 'ca-AD': /^(\+376)?[346]\d{5}$/,
64
+ 'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
65
+ 'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
66
+ 'de-DE': /^((\+49|0)1)(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/,
67
+ 'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
68
+ 'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
69
+ 'de-LU': /^(\+352)?((6\d1)\d{6})$/,
70
+ 'dv-MV': /^(\+?960)?(7[2-9]|9[1-9])\d{5}$/,
71
+ 'el-GR': /^(\+?30|0)?6(8[5-9]|9(?![26])[0-9])\d{7}$/,
72
+ 'el-CY': /^(\+?357?)?(9(9|6)\d{6})$/,
73
+ 'en-AI': /^(\+?1|0)264(?:2(35|92)|4(?:6[1-2]|76|97)|5(?:3[6-9]|8[1-4])|7(?:2(4|9)|72))\d{4}$/,
74
+ 'en-AU': /^(\+?61|0)4\d{8}$/,
75
+ 'en-AG': /^(?:\+1|1)268(?:464|7(?:1[3-9]|[28]\d|3[0246]|64|7[0-689]))\d{4}$/,
76
+ 'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}$))/,
77
+ 'en-BS': /^(\+?1[-\s]?|0)?\(?242\)?[-\s]?\d{3}[-\s]?\d{4}$/,
78
+ 'en-GB': /^(\+?44|0)7\d{9}$/,
79
+ 'en-GG': /^(\+?44|0)1481\d{6}$/,
80
+ 'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|28|55|59)\d{7}$/,
81
+ 'en-GY': /^(\+592|0)6\d{6}$/,
82
+ 'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,
83
+ 'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,
84
+ 'en-IE': /^(\+?353|0)8[356789]\d{7}$/,
85
+ 'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
86
+ 'en-JM': /^(\+?876)?\d{7}$/,
87
+ 'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
88
+ 'en-SS': /^(\+?211|0)(9[1257])\d{7}$/,
89
+ 'en-KI': /^((\+686|686)?)?( )?((6|7)(2|3|8)[0-9]{6})$/,
90
+ 'en-KN': /^(?:\+1|1)869(?:46\d|48[89]|55[6-8]|66\d|76[02-7])\d{4}$/,
91
+ 'en-LS': /^(\+?266)(22|28|57|58|59|27|52)\d{6}$/,
92
+ 'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,
93
+ 'en-MU': /^(\+?230|0)?\d{8}$/,
94
+ 'en-NA': /^(\+?264|0)(6|8)\d{7}$/,
95
+ 'en-NG': /^(\+?234|)?[789]\d{9}$/,
96
+ 'en-NZ': /^(\+?64|0)[28]\d{7,9}$/,
97
+ 'en-PG': /^(\+?675|0)?(7\d|8[18])\d{6}$/,
98
+ 'en-PK': /^((00|\+)?92|0)3[0-6]\d{8}$/,
99
+ 'en-PH': /^(09|\+639)\d{9}$/,
100
+ 'en-RW': /^(\+?250|0)?[7]\d{8}$/,
101
+ 'en-SG': /^(\+65)?[3689]\d{7}$/,
102
+ 'en-SL': /^(\+?232|0)\d{8}$/,
103
+ 'en-TZ': /^(\+?255|0)?[67]\d{8}$/,
104
+ 'en-UG': /^(\+?256|0)?[7]\d{8}$/,
105
+ 'en-US': /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/,
106
+ 'en-ZA': /^(\+?27|0)\d{9}$/,
107
+ 'en-ZM': /^(\+?26)?09[567]\d{7}$/,
108
+ 'en-ZW': /^(\+263)[0-9]{9}$/,
109
+ 'en-BW': /^(\+?267)?(7[1-8]{1})\d{6}$/,
110
+ 'es-AR': /^\+?549(11|[2368]\d)\d{8}$/,
111
+ 'es-BO': /^(\+?591)?(6|7)\d{7}$/,
112
+ 'es-CO': /^(\+?57)?3(0(0|1|2|4|5)|1\d|2[0-4]|5(0|1))\d{7}$/,
113
+ 'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/,
114
+ 'es-CR': /^(\+506)?[2-8]\d{7}$/,
115
+ 'es-CU': /^(\+53|0053)?5\d{7}/,
116
+ 'es-DO': /^(\+?1)?8[024]9\d{7}$/,
117
+ 'es-HN': /^(\+?504)?[9|8|3|2]\d{7}$/,
118
+ 'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/,
119
+ 'es-ES': /^(\+?34)?[6|7]\d{8}$/,
120
+ 'es-PE': /^(\+?51)?9\d{8}$/,
121
+ 'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
122
+ 'es-NI': /^(\+?505)\d{7,8}$/,
123
+ 'es-PA': /^(\+?507)\d{7,8}$/,
124
+ 'es-PY': /^(\+?595|0)9[9876]\d{7}$/,
125
+ 'es-SV': /^(\+?503)?[67]\d{7}$/,
126
+ 'es-UY': /^(\+598|0)9[1-9][\d]{6}$/,
127
+ 'es-VE': /^(\+?58)?(2|4)\d{9}$/,
128
+ 'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,
129
+ 'fa-IR': /^(\+?98[-\s]?|0)9[0-39]\d[-\s]?\d{3}[-\s]?\d{4}$/,
130
+ 'fi-FI': /^(\+?358|0)\s?(4[0-6]|50)\s?(\d\s?){4,8}$/,
131
+ 'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/,
132
+ 'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
133
+ 'fr-BF': /^(\+226|0)[67]\d{7}$/,
134
+ 'fr-BJ': /^(\+229)\d{8}$/,
135
+ 'fr-CD': /^(\+?243|0)?(8|9)\d{8}$/,
136
+ 'fr-CM': /^(\+?237)6[0-9]{8}$/,
137
+ 'fr-FR': /^(\+?33|0)[67]\d{8}$/,
138
+ 'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/,
139
+ 'fr-GP': /^(\+?590|0|00590)[67]\d{8}$/,
140
+ 'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/,
141
+ 'fr-PF': /^(\+?689)?8[789]\d{6}$/,
142
+ 'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
143
+ 'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
144
+ 'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,
145
+ 'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
146
+ 'ir-IR': /^(\+98|0)?9\d{9}$/,
147
+ 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
148
+ 'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/,
149
+ 'ja-JP': /^(\+81[ -]?(\(0\))?|0)[6789]0[ -]?\d{4}[ -]?\d{4}$/,
150
+ 'ka-GE': /^(\+?995)?(79\d{7}|5\d{8})$/,
151
+ 'kk-KZ': /^(\+?7|8)?7\d{9}$/,
152
+ 'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
153
+ 'ko-KR': /^((\+?82)[ -]?)?0?1([0|1|6|7|8|9]{1})[ -]?\d{3,4}[ -]?\d{4}$/,
154
+ 'ky-KG': /^(\+?7\s?\+?7|0)\s?\d{2}\s?\d{3}\s?\d{4}$/,
155
+ 'lt-LT': /^(\+370|8)\d{8}$/,
156
+ 'lv-LV': /^(\+?371)2\d{7}$/,
157
+ 'mg-MG': /^((\+?261|0)(2|3)\d)?\d{7}$/,
158
+ 'mn-MN': /^(\+|00|011)?976(77|81|88|91|94|95|96|99)\d{6}$/,
159
+ 'my-MM': /^(\+?959|09|9)(2[5-7]|3[1-2]|4[0-5]|6[6-9]|7[5-9]|9[6-9])[0-9]{7}$/,
160
+ 'ms-MY': /^(\+?60|0)1(([0145](-|\s)?\d{7,8})|([236-9](-|\s)?\d{7}))$/,
161
+ 'mz-MZ': /^(\+?258)?8[234567]\d{7}$/,
162
+ 'nb-NO': /^(\+?47)?[49]\d{7}$/,
163
+ 'ne-NP': /^(\+?977)?9[78]\d{8}$/,
164
+ 'nl-BE': /^(\+?32|0)4\d{8}$/,
165
+ 'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/,
166
+ 'nl-AW': /^(\+)?297(56|59|64|73|74|99)\d{5}$/,
167
+ 'nn-NO': /^(\+?47)?[49]\d{7}$/,
168
+ 'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
169
+ 'pt-BR': /^((\+?55 ?[1-9]{2} ?)|(\+?55 ?\([1-9]{2}\) ?)|(0[1-9]{2} ?)|(\([1-9]{2}\) ?)|([1-9]{2} ?))((\d{4}-?\d{4})|(9[1-9]{1}\d{3}-?\d{4}))$/,
170
+ 'pt-PT': /^(\+?351)?9[1236]\d{7}$/,
171
+ 'pt-AO': /^(\+244)\d{9}$/,
172
+ 'ro-MD': /^(\+?373|0)((6(0|1|2|6|7|8|9))|(7(6|7|8|9)))\d{6}$/,
173
+ 'ro-RO': /^(\+?40|0)\s?7\d{2}(\/|\s|\.|-)?\d{3}(\s|\.|-)?\d{3}$/,
174
+ 'ru-RU': /^(\+?7|8)?9\d{9}$/,
175
+ 'si-LK': /^(?:0|94|\+94)?(7(0|1|2|4|5|6|7|8)( |-)?)\d{7}$/,
176
+ 'sl-SI': /^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/,
177
+ 'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
178
+ 'sq-AL': /^(\+355|)6[789]\d{7}$/,
179
+ 'sr-RS': /^(\+3816|06)[- \d]{5,9}$/,
180
+ 'sv-SE': /^(\+?46|0)[\s-]?7[\s-]?[02369]([\s-]?\d){7}$/,
181
+ 'tg-TJ': /^(\+?992)?[5][5]\d{7}$/,
182
+ 'th-TH': /^(\+66|66|0)\d{9}$/,
183
+ 'tr-TR': /^(\+?90|0)?5\d{9}$/,
184
+ 'tk-TM': /^(\+993|993|8)\d{8}$/,
185
+ 'uk-UA': /^(\+?38|8)?0\d{9}$/,
186
+ 'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/,
187
+ 'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/,
188
+ 'zh-CN': /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/,
189
+ 'zh-TW': /^(\+?886-?|0)?9\d{8}$/,
190
+ 'dz-BT': /^(\+?975|0)?(17|16|77|02)\d{6}$/,
191
+ 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/,
192
+ 'ar-EH': /^(\+?212|0)[\s-]?(5288|5289)[\s-]?\d{5}$/,
193
+ 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/,
194
+ /* --------- [Alias] --------- */
195
+ 'en-CA': 'en-US',
196
+ 'fr-CA': 'en-CA',
197
+ 'fr-BE': 'nl-BE',
198
+ 'zh-HK': 'en-HK',
199
+ 'zh-MO': 'en-MO',
200
+ 'ga-IE': 'en-IE',
201
+ 'fr-CH': 'de-CH',
202
+ 'it-CH': 'fr-CH'
203
+ };
204
+ return TSMobilePhones;
205
+ }());
206
+ exports.TSMobilePhones = TSMobilePhones;
@@ -0,0 +1,149 @@
1
+ import { TSCurrencies, TSCurrency, type CurrencyCode } from './TSCurrencies';
2
+ declare class TSMoney {
3
+ amount: number;
4
+ currency: CurrencyCode;
5
+ /**
6
+ * Creates a new TSMoney instance. The created TSMoney instances is a value object thus it is immutable.
7
+ *
8
+ * @param {Number} amount
9
+ * @param {Object/String} currency
10
+ * @returns {TSMoney}
11
+ * @constructor
12
+ */
13
+ constructor(amount: number, currency: any | string);
14
+ static fromInteger(amount: number | any, currency?: string): TSMoney;
15
+ static fromDecimal(amount: number | any, currency?: string | any, rounder?: string | ((n: number) => number)): TSMoney;
16
+ /**
17
+ * Returns true if the two instances of TSMoney are equal, false otherwise.
18
+ *
19
+ * @param {TSMoney} other
20
+ * @returns {Boolean}
21
+ */
22
+ equals(other: TSMoney): boolean;
23
+ /**
24
+ * Adds the two objects together creating a new TSMoney instance that holds the result of the operation.
25
+ *
26
+ * @param {TSMoney} other
27
+ * @returns {TSMoney}
28
+ */
29
+ add(other: TSMoney): TSMoney;
30
+ /**
31
+ * Subtracts the two objects creating a new TSMoney instance that holds the result of the operation.
32
+ *
33
+ * @param {TSMoney} other
34
+ * @returns {TSMoney}
35
+ */
36
+ subtract(other: TSMoney): TSMoney;
37
+ /**
38
+ * Multiplies the object by the multiplier returning a new TSMoney instance that holds the result of the operation.
39
+ *
40
+ * @param {Number} multiplier
41
+ * @param {Function} [fn=Math.round]
42
+ * @returns {TSMoney}
43
+ */
44
+ multiply(multiplier: number, fn?: (n: number) => number): TSMoney;
45
+ /**
46
+ * Divides the object by the multiplier returning a new TSMoney instance that holds the result of the operation.
47
+ *
48
+ * @param {Number} divisor
49
+ * @param {Function} [fn=Math.round]
50
+ * @returns {TSMoney}
51
+ */
52
+ divide(divisor: number, fn?: (n: number) => number): TSMoney;
53
+ /**
54
+ * Allocates fund bases on the ratios provided returing an array of objects as a product of the allocation.
55
+ *
56
+ * @param {Array} other
57
+ * @returns {Array.TSMoney}
58
+ */
59
+ allocate(ratios: number[]): TSMoney[];
60
+ /**
61
+ * Compares two instances of TSMoney.
62
+ *
63
+ * @param {TSMoney} other
64
+ * @returns {Number}
65
+ */
66
+ compare(other: TSMoney): number;
67
+ /**
68
+ * Checks whether the value represented by this object is greater than the other.
69
+ *
70
+ * @param {TSMoney} other
71
+ * @returns {boolean}
72
+ */
73
+ greaterThan(other: TSMoney): boolean;
74
+ /**
75
+ * Checks whether the value represented by this object is greater or equal to the other.
76
+ *
77
+ * @param {TSMoney} other
78
+ * @returns {boolean}
79
+ */
80
+ greaterThanOrEqual(other: TSMoney): boolean;
81
+ /**
82
+ * Checks whether the value represented by this object is less than the other.
83
+ *
84
+ * @param {TSMoney} other
85
+ * @returns {boolean}
86
+ */
87
+ lessThan(other: TSMoney): boolean;
88
+ /**
89
+ * Checks whether the value represented by this object is less than or equal to the other.
90
+ *
91
+ * @param {TSMoney} other
92
+ * @returns {boolean}
93
+ */
94
+ lessThanOrEqual(other: TSMoney): boolean;
95
+ /**
96
+ * Returns true if the amount is zero.
97
+ *
98
+ * @returns {boolean}
99
+ */
100
+ isZero(): boolean;
101
+ /**
102
+ * Returns true if the amount is positive.
103
+ *
104
+ * @returns {boolean}
105
+ */
106
+ isPositive(): boolean;
107
+ /**
108
+ * Returns true if the amount is negative.
109
+ *
110
+ * @returns {boolean}
111
+ */
112
+ isNegative(): boolean;
113
+ /**
114
+ * Returns the decimal value as a float.
115
+ *
116
+ * @returns {number}
117
+ */
118
+ toDecimal(): number;
119
+ /**
120
+ * Returns the decimal value as a string.
121
+ *
122
+ * @returns {string}
123
+ */
124
+ toString(): string;
125
+ /**
126
+ * Returns a serialised version of the instance.
127
+ *
128
+ * @returns {{amount: number, currency: string}}
129
+ */
130
+ toJSON(): {
131
+ amount: number;
132
+ currency: CurrencyCode;
133
+ };
134
+ /**
135
+ * Returns the amount represented by this object.
136
+ *
137
+ * @returns {number}
138
+ */
139
+ getAmount(): number;
140
+ /**
141
+ * Returns the currency code represented by this object.
142
+ */
143
+ getCurrency(): CurrencyCode;
144
+ /**
145
+ * Returns the full currency object
146
+ */
147
+ getCurrencyInfo(): TSCurrency;
148
+ }
149
+ export { TSMoney, TSCurrencies };