@temboplus/frontend-core 0.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.
Files changed (261) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +72 -0
  3. package/esm/_dnt.test_shims.d.ts.map +1 -0
  4. package/esm/deps/deno.land/std@0.217.0/assert/_constants.d.ts.map +1 -0
  5. package/esm/deps/deno.land/std@0.217.0/assert/_diff.d.ts.map +1 -0
  6. package/esm/deps/deno.land/std@0.217.0/assert/_format.d.ts.map +1 -0
  7. package/esm/deps/deno.land/std@0.217.0/assert/assert.d.ts.map +1 -0
  8. package/esm/deps/deno.land/std@0.217.0/assert/assert_almost_equals.d.ts.map +1 -0
  9. package/esm/deps/deno.land/std@0.217.0/assert/assert_array_includes.d.ts.map +1 -0
  10. package/esm/deps/deno.land/std@0.217.0/assert/assert_equals.d.ts.map +1 -0
  11. package/esm/deps/deno.land/std@0.217.0/assert/assert_exists.d.ts.map +1 -0
  12. package/esm/deps/deno.land/std@0.217.0/assert/assert_false.d.ts.map +1 -0
  13. package/esm/deps/deno.land/std@0.217.0/assert/assert_greater.d.ts.map +1 -0
  14. package/esm/deps/deno.land/std@0.217.0/assert/assert_greater_or_equal.d.ts.map +1 -0
  15. package/esm/deps/deno.land/std@0.217.0/assert/assert_instance_of.d.ts.map +1 -0
  16. package/esm/deps/deno.land/std@0.217.0/assert/assert_is_error.d.ts.map +1 -0
  17. package/esm/deps/deno.land/std@0.217.0/assert/assert_less.d.ts.map +1 -0
  18. package/esm/deps/deno.land/std@0.217.0/assert/assert_less_or_equal.d.ts.map +1 -0
  19. package/esm/deps/deno.land/std@0.217.0/assert/assert_match.d.ts.map +1 -0
  20. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_equals.d.ts.map +1 -0
  21. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_instance_of.d.ts.map +1 -0
  22. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_match.d.ts.map +1 -0
  23. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_strict_equals.d.ts.map +1 -0
  24. package/esm/deps/deno.land/std@0.217.0/assert/assert_object_match.d.ts.map +1 -0
  25. package/esm/deps/deno.land/std@0.217.0/assert/assert_rejects.d.ts.map +1 -0
  26. package/esm/deps/deno.land/std@0.217.0/assert/assert_strict_equals.d.ts.map +1 -0
  27. package/esm/deps/deno.land/std@0.217.0/assert/assert_string_includes.d.ts.map +1 -0
  28. package/esm/deps/deno.land/std@0.217.0/assert/assert_throws.d.ts.map +1 -0
  29. package/esm/deps/deno.land/std@0.217.0/assert/assertion_error.d.ts.map +1 -0
  30. package/esm/deps/deno.land/std@0.217.0/assert/equal.d.ts.map +1 -0
  31. package/esm/deps/deno.land/std@0.217.0/assert/fail.d.ts.map +1 -0
  32. package/esm/deps/deno.land/std@0.217.0/assert/mod.d.ts.map +1 -0
  33. package/esm/deps/deno.land/std@0.217.0/assert/unimplemented.d.ts.map +1 -0
  34. package/esm/deps/deno.land/std@0.217.0/assert/unreachable.d.ts.map +1 -0
  35. package/esm/deps/deno.land/std@0.217.0/fmt/colors.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
  37. package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
  49. package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
  53. package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
  60. package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
  61. package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
  62. package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
  63. package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
  64. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
  65. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
  69. package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
  70. package/esm/mod.d.ts +3 -0
  71. package/esm/mod.d.ts.map +1 -0
  72. package/esm/mod.js +2 -0
  73. package/esm/package.json +3 -0
  74. package/esm/src/models/amount/amount.d.ts +55 -0
  75. package/esm/src/models/amount/amount.d.ts.map +1 -0
  76. package/esm/src/models/amount/amount.js +229 -0
  77. package/esm/src/models/amount/amount.test.d.ts.map +1 -0
  78. package/esm/src/models/amount/antd_validator.d.ts +40 -0
  79. package/esm/src/models/amount/antd_validator.d.ts.map +1 -0
  80. package/esm/src/models/amount/antd_validator.js +58 -0
  81. package/esm/src/models/amount/antd_validator.test.d.ts.map +1 -0
  82. package/esm/src/models/amount/index.d.ts +3 -0
  83. package/esm/src/models/amount/index.d.ts.map +1 -0
  84. package/esm/src/models/amount/index.js +2 -0
  85. package/esm/src/models/bank/antd_validator.d.ts +11 -0
  86. package/esm/src/models/bank/antd_validator.d.ts.map +1 -0
  87. package/esm/src/models/bank/antd_validator.js +26 -0
  88. package/esm/src/models/bank/antd_validator.test.d.ts.map +1 -0
  89. package/esm/src/models/bank/bank.d.ts +125 -0
  90. package/esm/src/models/bank/bank.d.ts.map +1 -0
  91. package/esm/src/models/bank/bank.js +229 -0
  92. package/esm/src/models/bank/bank.test.d.ts.map +1 -0
  93. package/esm/src/models/bank/banks.d.ts +7 -0
  94. package/esm/src/models/bank/banks.d.ts.map +1 -0
  95. package/esm/src/models/bank/banks.js +197 -0
  96. package/esm/src/models/bank/index.d.ts +4 -0
  97. package/esm/src/models/bank/index.d.ts.map +1 -0
  98. package/esm/src/models/bank/index.js +3 -0
  99. package/esm/src/models/bank/utils.d.ts +25 -0
  100. package/esm/src/models/bank/utils.d.ts.map +1 -0
  101. package/esm/src/models/bank/utils.js +35 -0
  102. package/esm/src/models/index.d.ts +4 -0
  103. package/esm/src/models/index.d.ts.map +1 -0
  104. package/esm/src/models/index.js +3 -0
  105. package/esm/src/models/phone_number/antd_validator.d.ts +77 -0
  106. package/esm/src/models/phone_number/antd_validator.d.ts.map +1 -0
  107. package/esm/src/models/phone_number/antd_validator.js +90 -0
  108. package/esm/src/models/phone_number/antdvalidator.test.d.ts.map +1 -0
  109. package/esm/src/models/phone_number/index.d.ts +4 -0
  110. package/esm/src/models/phone_number/index.d.ts.map +1 -0
  111. package/esm/src/models/phone_number/index.js +3 -0
  112. package/esm/src/models/phone_number/phone_number.d.ts +117 -0
  113. package/esm/src/models/phone_number/phone_number.d.ts.map +1 -0
  114. package/esm/src/models/phone_number/phone_number.js +231 -0
  115. package/esm/src/models/phone_number/phone_number.test.d.ts.map +1 -0
  116. package/esm/src/models/phone_number/telecom.d.ts +25 -0
  117. package/esm/src/models/phone_number/telecom.d.ts.map +1 -0
  118. package/esm/src/models/phone_number/telecom.js +44 -0
  119. package/esm/src/utils/id.d.ts +12 -0
  120. package/esm/src/utils/id.d.ts.map +1 -0
  121. package/esm/src/utils/id.js +19 -0
  122. package/esm/src/utils/index.d.ts +4 -0
  123. package/esm/src/utils/index.d.ts.map +1 -0
  124. package/esm/src/utils/index.js +3 -0
  125. package/esm/src/utils/text.d.ts +32 -0
  126. package/esm/src/utils/text.d.ts.map +1 -0
  127. package/esm/src/utils/text.js +68 -0
  128. package/esm/src/utils/text.test.d.ts.map +1 -0
  129. package/esm/src/utils/time.d.ts +21 -0
  130. package/esm/src/utils/time.d.ts.map +1 -0
  131. package/esm/src/utils/time.js +34 -0
  132. package/package.json +35 -0
  133. package/script/_dnt.test_shims.d.ts.map +1 -0
  134. package/script/deps/deno.land/std@0.217.0/assert/_constants.d.ts.map +1 -0
  135. package/script/deps/deno.land/std@0.217.0/assert/_diff.d.ts.map +1 -0
  136. package/script/deps/deno.land/std@0.217.0/assert/_format.d.ts.map +1 -0
  137. package/script/deps/deno.land/std@0.217.0/assert/assert.d.ts.map +1 -0
  138. package/script/deps/deno.land/std@0.217.0/assert/assert_almost_equals.d.ts.map +1 -0
  139. package/script/deps/deno.land/std@0.217.0/assert/assert_array_includes.d.ts.map +1 -0
  140. package/script/deps/deno.land/std@0.217.0/assert/assert_equals.d.ts.map +1 -0
  141. package/script/deps/deno.land/std@0.217.0/assert/assert_exists.d.ts.map +1 -0
  142. package/script/deps/deno.land/std@0.217.0/assert/assert_false.d.ts.map +1 -0
  143. package/script/deps/deno.land/std@0.217.0/assert/assert_greater.d.ts.map +1 -0
  144. package/script/deps/deno.land/std@0.217.0/assert/assert_greater_or_equal.d.ts.map +1 -0
  145. package/script/deps/deno.land/std@0.217.0/assert/assert_instance_of.d.ts.map +1 -0
  146. package/script/deps/deno.land/std@0.217.0/assert/assert_is_error.d.ts.map +1 -0
  147. package/script/deps/deno.land/std@0.217.0/assert/assert_less.d.ts.map +1 -0
  148. package/script/deps/deno.land/std@0.217.0/assert/assert_less_or_equal.d.ts.map +1 -0
  149. package/script/deps/deno.land/std@0.217.0/assert/assert_match.d.ts.map +1 -0
  150. package/script/deps/deno.land/std@0.217.0/assert/assert_not_equals.d.ts.map +1 -0
  151. package/script/deps/deno.land/std@0.217.0/assert/assert_not_instance_of.d.ts.map +1 -0
  152. package/script/deps/deno.land/std@0.217.0/assert/assert_not_match.d.ts.map +1 -0
  153. package/script/deps/deno.land/std@0.217.0/assert/assert_not_strict_equals.d.ts.map +1 -0
  154. package/script/deps/deno.land/std@0.217.0/assert/assert_object_match.d.ts.map +1 -0
  155. package/script/deps/deno.land/std@0.217.0/assert/assert_rejects.d.ts.map +1 -0
  156. package/script/deps/deno.land/std@0.217.0/assert/assert_strict_equals.d.ts.map +1 -0
  157. package/script/deps/deno.land/std@0.217.0/assert/assert_string_includes.d.ts.map +1 -0
  158. package/script/deps/deno.land/std@0.217.0/assert/assert_throws.d.ts.map +1 -0
  159. package/script/deps/deno.land/std@0.217.0/assert/assertion_error.d.ts.map +1 -0
  160. package/script/deps/deno.land/std@0.217.0/assert/equal.d.ts.map +1 -0
  161. package/script/deps/deno.land/std@0.217.0/assert/fail.d.ts.map +1 -0
  162. package/script/deps/deno.land/std@0.217.0/assert/mod.d.ts.map +1 -0
  163. package/script/deps/deno.land/std@0.217.0/assert/unimplemented.d.ts.map +1 -0
  164. package/script/deps/deno.land/std@0.217.0/assert/unreachable.d.ts.map +1 -0
  165. package/script/deps/deno.land/std@0.217.0/fmt/colors.d.ts.map +1 -0
  166. package/script/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
  167. package/script/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
  168. package/script/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
  169. package/script/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
  170. package/script/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
  171. package/script/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
  172. package/script/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
  173. package/script/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
  174. package/script/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
  175. package/script/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
  176. package/script/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
  177. package/script/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
  178. package/script/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
  179. package/script/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
  180. package/script/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
  181. package/script/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
  182. package/script/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
  183. package/script/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
  184. package/script/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
  185. package/script/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
  186. package/script/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
  187. package/script/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
  188. package/script/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
  189. package/script/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
  190. package/script/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
  191. package/script/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
  192. package/script/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
  193. package/script/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
  194. package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
  195. package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
  196. package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
  197. package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
  198. package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
  199. package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
  200. package/script/mod.d.ts +3 -0
  201. package/script/mod.d.ts.map +1 -0
  202. package/script/mod.js +18 -0
  203. package/script/package.json +3 -0
  204. package/script/src/models/amount/amount.d.ts +55 -0
  205. package/script/src/models/amount/amount.d.ts.map +1 -0
  206. package/script/src/models/amount/amount.js +233 -0
  207. package/script/src/models/amount/amount.test.d.ts.map +1 -0
  208. package/script/src/models/amount/antd_validator.d.ts +40 -0
  209. package/script/src/models/amount/antd_validator.d.ts.map +1 -0
  210. package/script/src/models/amount/antd_validator.js +62 -0
  211. package/script/src/models/amount/antd_validator.test.d.ts.map +1 -0
  212. package/script/src/models/amount/index.d.ts +3 -0
  213. package/script/src/models/amount/index.d.ts.map +1 -0
  214. package/script/src/models/amount/index.js +18 -0
  215. package/script/src/models/bank/antd_validator.d.ts +11 -0
  216. package/script/src/models/bank/antd_validator.d.ts.map +1 -0
  217. package/script/src/models/bank/antd_validator.js +30 -0
  218. package/script/src/models/bank/antd_validator.test.d.ts.map +1 -0
  219. package/script/src/models/bank/bank.d.ts +125 -0
  220. package/script/src/models/bank/bank.d.ts.map +1 -0
  221. package/script/src/models/bank/bank.js +236 -0
  222. package/script/src/models/bank/bank.test.d.ts.map +1 -0
  223. package/script/src/models/bank/banks.d.ts +7 -0
  224. package/script/src/models/bank/banks.d.ts.map +1 -0
  225. package/script/src/models/bank/banks.js +199 -0
  226. package/script/src/models/bank/index.d.ts +4 -0
  227. package/script/src/models/bank/index.d.ts.map +1 -0
  228. package/script/src/models/bank/index.js +19 -0
  229. package/script/src/models/bank/utils.d.ts +25 -0
  230. package/script/src/models/bank/utils.d.ts.map +1 -0
  231. package/script/src/models/bank/utils.js +41 -0
  232. package/script/src/models/index.d.ts +4 -0
  233. package/script/src/models/index.d.ts.map +1 -0
  234. package/script/src/models/index.js +19 -0
  235. package/script/src/models/phone_number/antd_validator.d.ts +77 -0
  236. package/script/src/models/phone_number/antd_validator.d.ts.map +1 -0
  237. package/script/src/models/phone_number/antd_validator.js +94 -0
  238. package/script/src/models/phone_number/antdvalidator.test.d.ts.map +1 -0
  239. package/script/src/models/phone_number/index.d.ts +4 -0
  240. package/script/src/models/phone_number/index.d.ts.map +1 -0
  241. package/script/src/models/phone_number/index.js +19 -0
  242. package/script/src/models/phone_number/phone_number.d.ts +117 -0
  243. package/script/src/models/phone_number/phone_number.d.ts.map +1 -0
  244. package/script/src/models/phone_number/phone_number.js +235 -0
  245. package/script/src/models/phone_number/phone_number.test.d.ts.map +1 -0
  246. package/script/src/models/phone_number/telecom.d.ts +25 -0
  247. package/script/src/models/phone_number/telecom.d.ts.map +1 -0
  248. package/script/src/models/phone_number/telecom.js +47 -0
  249. package/script/src/utils/id.d.ts +12 -0
  250. package/script/src/utils/id.d.ts.map +1 -0
  251. package/script/src/utils/id.js +23 -0
  252. package/script/src/utils/index.d.ts +4 -0
  253. package/script/src/utils/index.d.ts.map +1 -0
  254. package/script/src/utils/index.js +19 -0
  255. package/script/src/utils/text.d.ts +32 -0
  256. package/script/src/utils/text.d.ts.map +1 -0
  257. package/script/src/utils/text.js +75 -0
  258. package/script/src/utils/text.test.d.ts.map +1 -0
  259. package/script/src/utils/time.d.ts +21 -0
  260. package/script/src/utils/time.d.ts.map +1 -0
  261. package/script/src/utils/time.js +39 -0
@@ -0,0 +1,90 @@
1
+ import { PhoneNumber } from "./phone_number.js";
2
+ /**
3
+ * Validates a Tanzanian phone number according to specified format rules.
4
+ * This validator is designed for Ant Design Form components and performs the following validations:
5
+ * 1. Required field validation (if specified in rules)
6
+ * 2. Format validation for valid Tanzanian phone numbers using TZ_PHONE_NUMBER_REGEX
7
+ *
8
+ * The validator accepts phone numbers in the following formats:
9
+ * Format 1: With prefix
10
+ * - Starting with 255, 0, or +255
11
+ * - Followed by valid operator codes:
12
+ * • Vodacom: 74, 75, 76, 78, 79
13
+ * • Tigo: 65, 67, 71
14
+ * • Airtel: 68, 69, 77
15
+ * • Halotel: 61, 62
16
+ * - Followed by 7 digits
17
+ *
18
+ * Format 2: Without prefix
19
+ * - Starting directly with operator code (listed above)
20
+ * - Followed by 7 digits
21
+ *
22
+ * @param {RuleObject} rule - Ant Design rule object containing validation rules
23
+ * @param {string | null | undefined} value - The phone number to validate
24
+ * @returns {Promise<void>} Resolves if validation passes, rejects with Error if validation fails
25
+ * @throws {Error} Throws an error with a descriptive message for validation failures:
26
+ * - "Phone number is required." - When field is required but empty/null/undefined
27
+ * - "Invalid phone number format." - When value doesn't match expected TZ phone number format
28
+ *
29
+ * @example
30
+ * // Usage in Ant Design form rules:
31
+ * const rules = [
32
+ * {
33
+ * required: true,
34
+ * validator: PHONENUMBER_VALIDATOR
35
+ * }
36
+ * ];
37
+ *
38
+ * // Valid inputs:
39
+ * // "+255742345678" -> International format with plus (Vodacom)
40
+ * // "255652345678" -> International format without plus (Tigo)
41
+ * // "0712345678" -> Local format with leading zero (Tigo)
42
+ * // "652345678" -> Local format without prefix (Tigo)
43
+ *
44
+ * // Invalid inputs:
45
+ * // "+255722345678" -> Invalid operator code (72)
46
+ * // "652345" -> Too short
47
+ * // "6523456789" -> Too long
48
+ * // "abc65234567" -> Non-numeric characters
49
+ * // "" -> Empty when required
50
+ * // undefined -> Missing when required
51
+ * // null -> Null when required
52
+ *
53
+ * @notes
54
+ * The validator uses TZ_PHONE_NUMBER_REGEX which matches:
55
+ * ^(?:255|0|\+255)(74|75|76|78|79|68|69|71|65|67|77|62|61)\d{7}$|^(?:74|75|76|78|79|68|69|71|65|67|77|62|61)\d{7}$
56
+ *
57
+ * This breaks down to:
58
+ * ^ -> Start of string
59
+ * (?:255|0|\+255) -> Country code group: 255, 0, or +255
60
+ * ( -> Start operator code group
61
+ * 74|75|76|78|79 -> Vodacom prefixes
62
+ * |68|69|71 -> Tigo prefixes
63
+ * |65|67|77 -> Airtel prefixes
64
+ * |62|61 -> Halotel prefixes
65
+ * ) -> End operator code group
66
+ * \d{7} -> Exactly 7 digits
67
+ * $ -> End of string
68
+ * | -> OR
69
+ * ^ -> Start of string (alternative format)
70
+ * (same operator codes as above)
71
+ * \d{7} -> Exactly 7 digits
72
+ * $ -> End of string
73
+ */
74
+ export const TZ_PHONE_NUMBER_REGEX = /^(?:255|0|\+255)(74|75|76|78|79|68|69|71|65|67|77|62|61)\d{7}$|^(?:74|75|76|78|79|68|69|71|65|67|77|62|61)\d{7}$/;
75
+ export const PHONENUMBER_VALIDATOR = (rule, value) => {
76
+ const phoneString = value?.toString().trim();
77
+ // If field is empty/undefined/null
78
+ if (!phoneString) {
79
+ // Only throw if the field is required
80
+ if (rule.required) {
81
+ return Promise.reject(new Error("Phone number is required."));
82
+ }
83
+ // If field is not required and empty, validation passes
84
+ return Promise.resolve(undefined);
85
+ }
86
+ const phone = PhoneNumber.from(phoneString);
87
+ if (phone)
88
+ return Promise.resolve(phone);
89
+ return Promise.reject(new Error("Invalid phone number format."));
90
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antdvalidator.test.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/antdvalidator.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from "./antd_validator.js";
2
+ export * from "./phone_number.js";
3
+ export * from "./telecom.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./antd_validator.js";
2
+ export * from "./phone_number.js";
3
+ export * from "./telecom.js";
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @fileoverview
3
+ *
4
+ * # Tanzania Phone Number Management System
5
+ *
6
+ * ## Problem Statement
7
+ * Tanzania's phone number system requires specific validation and formatting rules:
8
+ *
9
+ * 1. Phone numbers can be entered in multiple formats:
10
+ * - International format: "+255712345678"
11
+ * - Local format with country code: "255712345678"
12
+ * - Local format with leading zero: "0712345678"
13
+ * - Compact format: "712345678"
14
+ *
15
+ * 2. Valid numbers must:
16
+ * - Have exactly 9 digits after removing prefixes
17
+ * - Start with a valid telecom provider prefix
18
+ * - Contain only numeric characters
19
+ *
20
+ * 3. Each telecom provider has specific prefixes:
21
+ * - Vodacom: 71, 74, 75, etc.
22
+ * - Airtel: 68, 69, etc.
23
+ * - Tigo: 65, 67, etc.
24
+ *
25
+ * ## Solution
26
+ * The PhoneNumber class provides:
27
+ * 1. Parsing and validation of different input formats
28
+ * 2. Standardized storage in compact format
29
+ * 3. Formatting options for display and API use
30
+ * 4. Telecom provider identification
31
+ */
32
+ import { type Telecom } from "./telecom.js";
33
+ /**
34
+ * Enumeration for various mobile number formats.
35
+ * @enum {string}
36
+ */
37
+ export declare enum MobileNumberFormat {
38
+ s255 = "255",// Mobile numbers prefixed with 255
39
+ sp255 = "+255",// Mobile numbers prefixed with +255
40
+ s0 = "0",// Mobile numbers prefixed with 0
41
+ none = ""
42
+ }
43
+ /**
44
+ * Represents a TZ phone number
45
+ */
46
+ export declare class PhoneNumber {
47
+ /**
48
+ * Stores the phone number in a compact format excluding country code and the initial '0'.
49
+ */
50
+ compactNumber: string;
51
+ /**
52
+ * Constructs a new `PhoneNumber` instance.
53
+ *
54
+ * @param compactNumber - The phone number in a compact format (e.g., "712345678").
55
+ */
56
+ constructor(compactNumber: string);
57
+ /**
58
+ * Formats the compact phone number with the specified `MobileNumberFormat`.
59
+ *
60
+ * @param format - The desired phone number format (e.g., `+255` or `255`).
61
+ * @returns The phone number formatted as a string.
62
+ */
63
+ getNumberWithFormat(format: MobileNumberFormat): string;
64
+ /**
65
+ * Returns the formatted label of the phone number using the `s255` format.
66
+ *
67
+ * @returns The phone number label in `255` format.
68
+ */
69
+ get label(): string;
70
+ /**
71
+ * Derives the telecom details associated with the phone number by checking its prefix.
72
+ *
73
+ * @returns The `Telecom` object that matches the phone number prefix.
74
+ */
75
+ get telecom(): Telecom;
76
+ /**
77
+ * Creates a `PhoneNumber` instance from a given string.
78
+ *
79
+ * @param s - The input phone number string in various formats (e.g., "+255712345678", "0712345678").
80
+ * @returns A `PhoneNumber` instance if valid, otherwise `undefined`.
81
+ */
82
+ static from(s: string): PhoneNumber | undefined;
83
+ /**
84
+ * Checks if a string can be constructed into a valid phone number object.
85
+ * @param {string | undefined} input - The string to validate as a phone number.
86
+ * @returns {boolean} - Returns true if the input can be constructed into a valid phone number object,
87
+ * false if the input is undefined, empty, or cannot be parsed.
88
+ */
89
+ static canConstruct(input?: string | null): boolean;
90
+ /**
91
+ * Checks if an unknown value contains valid data to construct a PhoneNumber instance.
92
+ * Validates the structural integrity of the phone number object.
93
+ *
94
+ * @param {unknown} obj - The value to validate.
95
+ * @returns {obj is PhoneNumber} Type predicate indicating if the value has a valid phone number structure.
96
+ *
97
+ * @example
98
+ * const maybePhone = JSON.parse(someData);
99
+ * if (PhoneNumber.is(maybePhone)) {
100
+ * // maybePhone is typed as PhoneNumber
101
+ * console.log(maybePhone.label);
102
+ * }
103
+ *
104
+ * @remarks
105
+ * Validates:
106
+ * - Has required compactNumber property
107
+ * - compactNumber is a 9-digit string
108
+ * - Prefix matches a valid telecom provider
109
+ */
110
+ static is(obj: unknown): obj is PhoneNumber;
111
+ /**
112
+ * Checks the validity of the phone number data
113
+ * @returns true if the phone number information is available and valid
114
+ */
115
+ validate(): boolean;
116
+ }
117
+ //# sourceMappingURL=phone_number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAkB,MAAM,cAAc,CAAC;AAE5D;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,IAAI,QAAQ,CAAE,mCAAmC;IACjD,KAAK,SAAS,CAAE,oCAAoC;IACpD,EAAE,MAAM,CAAE,iCAAiC;IAC3C,IAAI,KAAK;CACV;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;gBACS,aAAa,EAAE,MAAM;IAIjC;;;;;OAKG;IACH,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;IAIvD;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,OAAO,CAMrB;IAED;;;;;OAKG;WACW,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAqCtD;;;;;OAKG;WACW,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAW1D;;;;;;;;;;;;;;;;;;;OAmBG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW;IAYlD;;;OAGG;IACI,QAAQ,IAAI,OAAO;CAO3B"}
@@ -0,0 +1,231 @@
1
+ /**
2
+ * @fileoverview
3
+ *
4
+ * # Tanzania Phone Number Management System
5
+ *
6
+ * ## Problem Statement
7
+ * Tanzania's phone number system requires specific validation and formatting rules:
8
+ *
9
+ * 1. Phone numbers can be entered in multiple formats:
10
+ * - International format: "+255712345678"
11
+ * - Local format with country code: "255712345678"
12
+ * - Local format with leading zero: "0712345678"
13
+ * - Compact format: "712345678"
14
+ *
15
+ * 2. Valid numbers must:
16
+ * - Have exactly 9 digits after removing prefixes
17
+ * - Start with a valid telecom provider prefix
18
+ * - Contain only numeric characters
19
+ *
20
+ * 3. Each telecom provider has specific prefixes:
21
+ * - Vodacom: 71, 74, 75, etc.
22
+ * - Airtel: 68, 69, etc.
23
+ * - Tigo: 65, 67, etc.
24
+ *
25
+ * ## Solution
26
+ * The PhoneNumber class provides:
27
+ * 1. Parsing and validation of different input formats
28
+ * 2. Standardized storage in compact format
29
+ * 3. Formatting options for display and API use
30
+ * 4. Telecom provider identification
31
+ */
32
+ import { telecomDetails } from "./telecom.js";
33
+ /**
34
+ * Enumeration for various mobile number formats.
35
+ * @enum {string}
36
+ */
37
+ export var MobileNumberFormat;
38
+ (function (MobileNumberFormat) {
39
+ MobileNumberFormat["s255"] = "255";
40
+ MobileNumberFormat["sp255"] = "+255";
41
+ MobileNumberFormat["s0"] = "0";
42
+ MobileNumberFormat["none"] = "";
43
+ })(MobileNumberFormat || (MobileNumberFormat = {}));
44
+ /**
45
+ * Represents a TZ phone number
46
+ */
47
+ export class PhoneNumber {
48
+ /**
49
+ * Constructs a new `PhoneNumber` instance.
50
+ *
51
+ * @param compactNumber - The phone number in a compact format (e.g., "712345678").
52
+ */
53
+ constructor(compactNumber) {
54
+ /**
55
+ * Stores the phone number in a compact format excluding country code and the initial '0'.
56
+ */
57
+ Object.defineProperty(this, "compactNumber", {
58
+ enumerable: true,
59
+ configurable: true,
60
+ writable: true,
61
+ value: void 0
62
+ });
63
+ this.compactNumber = compactNumber;
64
+ }
65
+ /**
66
+ * Formats the compact phone number with the specified `MobileNumberFormat`.
67
+ *
68
+ * @param format - The desired phone number format (e.g., `+255` or `255`).
69
+ * @returns The phone number formatted as a string.
70
+ */
71
+ getNumberWithFormat(format) {
72
+ return `${format}${this.compactNumber}`;
73
+ }
74
+ /**
75
+ * Returns the formatted label of the phone number using the `s255` format.
76
+ *
77
+ * @returns The phone number label in `255` format.
78
+ */
79
+ get label() {
80
+ return this.getNumberWithFormat(MobileNumberFormat.s255);
81
+ }
82
+ /**
83
+ * Derives the telecom details associated with the phone number by checking its prefix.
84
+ *
85
+ * @returns The `Telecom` object that matches the phone number prefix.
86
+ */
87
+ get telecom() {
88
+ const id = this.compactNumber.substring(0, 2);
89
+ const result = Object.values(telecomDetails).find((e) => e.prefixes.includes(id));
90
+ return result;
91
+ }
92
+ /**
93
+ * Creates a `PhoneNumber` instance from a given string.
94
+ *
95
+ * @param s - The input phone number string in various formats (e.g., "+255712345678", "0712345678").
96
+ * @returns A `PhoneNumber` instance if valid, otherwise `undefined`.
97
+ */
98
+ static from(s) {
99
+ try {
100
+ const number = removeSpaces(s.trim());
101
+ if (number.length === 0)
102
+ return;
103
+ const isOnlyDigits = isOnlyDigitsOrPlus(number);
104
+ if (!isOnlyDigits)
105
+ return;
106
+ let compactNumber;
107
+ // Extract the compact number by removing country or local dialing prefixes.
108
+ if (number.startsWith("+255")) {
109
+ compactNumber = number.substring(4);
110
+ }
111
+ else if (number.startsWith("255")) {
112
+ compactNumber = number.substring(3);
113
+ }
114
+ else if (number.startsWith("0")) {
115
+ compactNumber = number.substring(1);
116
+ }
117
+ else {
118
+ compactNumber = number;
119
+ }
120
+ // Validate that the compact number length is correct.
121
+ if (compactNumber.length !== 9)
122
+ return;
123
+ // Check if the compact number matches any telecom provider prefix.
124
+ const id = compactNumber.substring(0, 2);
125
+ const telecom = Object.values(telecomDetails).find((e) => e.prefixes.includes(id));
126
+ if (!telecom)
127
+ return;
128
+ return new PhoneNumber(compactNumber);
129
+ }
130
+ catch (_) {
131
+ return;
132
+ }
133
+ }
134
+ /**
135
+ * Checks if a string can be constructed into a valid phone number object.
136
+ * @param {string | undefined} input - The string to validate as a phone number.
137
+ * @returns {boolean} - Returns true if the input can be constructed into a valid phone number object,
138
+ * false if the input is undefined, empty, or cannot be parsed.
139
+ */
140
+ static canConstruct(input) {
141
+ if (!input || typeof input !== "string")
142
+ return false;
143
+ const text = removeSpaces(input.trim());
144
+ if (text.length === 0)
145
+ return false;
146
+ const phone = PhoneNumber.from(text);
147
+ return phone !== undefined;
148
+ }
149
+ /**
150
+ * Checks if an unknown value contains valid data to construct a PhoneNumber instance.
151
+ * Validates the structural integrity of the phone number object.
152
+ *
153
+ * @param {unknown} obj - The value to validate.
154
+ * @returns {obj is PhoneNumber} Type predicate indicating if the value has a valid phone number structure.
155
+ *
156
+ * @example
157
+ * const maybePhone = JSON.parse(someData);
158
+ * if (PhoneNumber.is(maybePhone)) {
159
+ * // maybePhone is typed as PhoneNumber
160
+ * console.log(maybePhone.label);
161
+ * }
162
+ *
163
+ * @remarks
164
+ * Validates:
165
+ * - Has required compactNumber property
166
+ * - compactNumber is a 9-digit string
167
+ * - Prefix matches a valid telecom provider
168
+ */
169
+ static is(obj) {
170
+ if (!obj || typeof obj !== "object")
171
+ return false;
172
+ const maybePhone = obj;
173
+ // Check if compactNumber exists and is string
174
+ if (typeof maybePhone.compactNumber !== "string")
175
+ return false;
176
+ const compactNumber = maybePhone.compactNumber;
177
+ return PhoneNumber.canConstruct(compactNumber);
178
+ }
179
+ /**
180
+ * Checks the validity of the phone number data
181
+ * @returns true if the phone number information is available and valid
182
+ */
183
+ validate() {
184
+ try {
185
+ return PhoneNumber.canConstruct(this.compactNumber);
186
+ }
187
+ catch (_) {
188
+ return false;
189
+ }
190
+ }
191
+ }
192
+ /**
193
+ * Removes all whitespace characters from the given string.
194
+ *
195
+ * This function replaces all occurrences of spaces, tabs, and other
196
+ * whitespace characters (including multiple spaces) in the input string
197
+ * with an empty string, effectively removing them.
198
+ *
199
+ * @param {string} input - The input string from which spaces should be removed.
200
+ * @returns {string} A new string with all whitespace characters removed.
201
+ *
202
+ * @example
203
+ * removeSpaces(" Hello World "); // Returns: "HelloWorld"
204
+ * removeSpaces("NoSpacesHere"); // Returns: "NoSpacesHere"
205
+ * removeSpaces(" "); // Returns: ""
206
+ */
207
+ function removeSpaces(input) {
208
+ return input.replace(/\s+/g, "");
209
+ }
210
+ /**
211
+ * Checks if a given string contains only digits or a `+` prefix followed by digits.
212
+ *
213
+ * This function validates that the input string:
214
+ * - Can optionally start with a `+` sign.
215
+ * - Must have one or more digits after the optional `+`.
216
+ * - Does not contain any other characters besides digits and the `+` prefix.
217
+ *
218
+ * @param {string} input - The input string to validate.
219
+ * @returns {boolean} `true` if the string contains only digits or a `+` prefix followed by digits; otherwise, `false`.
220
+ *
221
+ * @example
222
+ * isOnlyDigitsOrPlus("12345"); // Returns: true
223
+ * isOnlyDigitsOrPlus("+12345"); // Returns: true
224
+ * isOnlyDigitsOrPlus("123a45"); // Returns: false
225
+ * isOnlyDigitsOrPlus("+"); // Returns: false
226
+ * isOnlyDigitsOrPlus(""); // Returns: false
227
+ */
228
+ function isOnlyDigitsOrPlus(input) {
229
+ const digitWithPlusRegex = /^\+?\d+$/;
230
+ return digitWithPlusRegex.test(input);
231
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone_number.test.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/phone_number.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Enumeration for telecom identifiers.
3
+ * @enum {string}
4
+ */
5
+ export declare enum TelecomID {
6
+ vodacom = "vodacom",
7
+ airtel = "airtel",
8
+ tigo = "tigo",
9
+ halotel = "halotel"
10
+ }
11
+ /**
12
+ * Interface representing a telecom provider.
13
+ */
14
+ export interface Telecom {
15
+ id: TelecomID;
16
+ prefixes: string[];
17
+ label: string;
18
+ company: string;
19
+ color: string;
20
+ }
21
+ /**
22
+ * Details for each telecom provider including prefixes and branding information.
23
+ */
24
+ export declare const telecomDetails: Record<TelecomID, Telecom>;
25
+ //# sourceMappingURL=telecom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telecom.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/telecom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,SAAS;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,SAAS,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CA6BrD,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Enumeration for telecom identifiers.
3
+ * @enum {string}
4
+ */
5
+ export var TelecomID;
6
+ (function (TelecomID) {
7
+ TelecomID["vodacom"] = "vodacom";
8
+ TelecomID["airtel"] = "airtel";
9
+ TelecomID["tigo"] = "tigo";
10
+ TelecomID["halotel"] = "halotel";
11
+ })(TelecomID || (TelecomID = {}));
12
+ /**
13
+ * Details for each telecom provider including prefixes and branding information.
14
+ */
15
+ export const telecomDetails = {
16
+ vodacom: {
17
+ id: TelecomID.vodacom,
18
+ prefixes: ["74", "75", "76"],
19
+ label: "Vodacom",
20
+ company: "M-Pesa",
21
+ color: "red",
22
+ },
23
+ airtel: {
24
+ id: TelecomID.airtel,
25
+ prefixes: ["78", "79", "68", "69"],
26
+ label: "Airtel",
27
+ company: "Airtel-Money",
28
+ color: "volcano",
29
+ },
30
+ tigo: {
31
+ id: TelecomID.tigo,
32
+ prefixes: ["71", "65", "67", "77"],
33
+ label: "Tigo",
34
+ company: "Tigo-Pesa",
35
+ color: "blue",
36
+ },
37
+ halotel: {
38
+ id: TelecomID.halotel,
39
+ prefixes: ["62", "61"],
40
+ label: "Halotel",
41
+ company: "Halo-Pesa",
42
+ color: "orange",
43
+ },
44
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generates a unique UUID (version 4).
3
+ * @returns {string} - A randomly generated UUID string.
4
+ */
5
+ export declare function generateUniqueUUID(): string;
6
+ /**
7
+ * Generates a UUID (version 5) based on the input string and a predefined namespace.
8
+ * @param {string} data - The input string to generate the UUID from.
9
+ * @returns {string} - A UUID string generated from the input string.
10
+ */
11
+ export declare function generateUuidBasedOn(data: string): string;
12
+ //# sourceMappingURL=id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../src/src/utils/id.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAKD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,19 @@
1
+ import { v4 as uuidv4 } from "uuid";
2
+ import { v5 as uuidv5 } from "uuid";
3
+ /**
4
+ * Generates a unique UUID (version 4).
5
+ * @returns {string} - A randomly generated UUID string.
6
+ */
7
+ export function generateUniqueUUID() {
8
+ return uuidv4();
9
+ }
10
+ // Predefined namespace
11
+ const NAMESPACE = uuidv5.DNS;
12
+ /**
13
+ * Generates a UUID (version 5) based on the input string and a predefined namespace.
14
+ * @param {string} data - The input string to generate the UUID from.
15
+ * @returns {string} - A UUID string generated from the input string.
16
+ */
17
+ export function generateUuidBasedOn(data) {
18
+ return uuidv5(data, NAMESPACE);
19
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./id.js";
2
+ export * from "./time.js";
3
+ export * from "./text.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./id.js";
2
+ export * from "./time.js";
3
+ export * from "./text.js";
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Capitalizes the first letter of a string and converts the rest of the string to lowercase.
3
+ * @param {string} str - The input string.
4
+ * @returns {string} - The formatted string with the first letter capitalized.
5
+ */
6
+ export declare function capitalizeFirstLetter(str: string): string;
7
+ /**
8
+ * Combines a first name and a last name into a full name.
9
+ * @param {string} firstName - The first name.
10
+ * @param {string} lastName - The last name.
11
+ * @returns {string} - The full name formatted as "FirstName LastName".
12
+ */
13
+ export declare function getFullName(firstName: string, lastName: string): string;
14
+ /**
15
+ * Generates a URL-friendly slug from a given text.
16
+ * @param {string} text - The input string.
17
+ * @returns {string} - The generated slug with lowercase alphanumeric characters and hyphens.
18
+ */
19
+ export declare function generateSlug(text: string): string;
20
+ /**
21
+ * Abbreviates a full name into a first name and the initial of the last name.
22
+ * @param {string} fullName - The input full name.
23
+ * @returns {string} - The abbreviated name in the format "FirstName L.".
24
+ */
25
+ export declare function abbreviateName(fullName: string): string;
26
+ /**
27
+ * Extracts the initials from a full name.
28
+ * @param {string} fullName - The input full name.
29
+ * @returns {string} - The initials in uppercase format.
30
+ */
31
+ export declare function getInitialsFrom(fullName: string): string;
32
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/src/utils/text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAcxD"}