@develia/commons 0.4.18 → 0.4.20

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 (259) hide show
  1. package/dist/cjs/array.js +0 -0
  2. package/dist/cjs/array.js.map +0 -0
  3. package/dist/cjs/async-pool-executor.js +0 -0
  4. package/dist/cjs/async-pool-executor.js.map +0 -0
  5. package/dist/cjs/browser/form-utilities.js +0 -0
  6. package/dist/cjs/browser/form-utilities.js.map +0 -0
  7. package/dist/cjs/browser/geo-location.js +0 -0
  8. package/dist/cjs/browser/geo-location.js.map +0 -0
  9. package/dist/cjs/browser/index.js +0 -0
  10. package/dist/cjs/browser/index.js.map +0 -0
  11. package/dist/cjs/browser/native-bridge.js +0 -0
  12. package/dist/cjs/browser/native-bridge.js.map +0 -0
  13. package/dist/cjs/cancellable-promise.js +0 -0
  14. package/dist/cjs/cancellable-promise.js.map +0 -0
  15. package/dist/cjs/clean-url-search-params.js +0 -0
  16. package/dist/cjs/clean-url-search-params.js.map +0 -0
  17. package/dist/cjs/collections/cache-dictionary.js +0 -0
  18. package/dist/cjs/collections/cache-dictionary.js.map +0 -0
  19. package/dist/cjs/collections/default-map.js +0 -0
  20. package/dist/cjs/collections/default-map.js.map +0 -0
  21. package/dist/cjs/collections/default-weak-map.js +0 -0
  22. package/dist/cjs/collections/default-weak-map.js.map +0 -0
  23. package/dist/cjs/collections/from.js +0 -0
  24. package/dist/cjs/collections/from.js.map +0 -0
  25. package/dist/cjs/collections/index.js +0 -0
  26. package/dist/cjs/collections/index.js.map +0 -0
  27. package/dist/cjs/draft.js +0 -0
  28. package/dist/cjs/draft.js.map +0 -0
  29. package/dist/cjs/event-bus.js +0 -0
  30. package/dist/cjs/event-bus.js.map +0 -0
  31. package/dist/cjs/functions.js +0 -0
  32. package/dist/cjs/functions.js.map +0 -0
  33. package/dist/cjs/index.js +0 -0
  34. package/dist/cjs/index.js.map +0 -0
  35. package/dist/cjs/key-value-pair.js +0 -0
  36. package/dist/cjs/key-value-pair.js.map +0 -0
  37. package/dist/cjs/lazy.js +0 -0
  38. package/dist/cjs/lazy.js.map +0 -0
  39. package/dist/cjs/math.js +0 -0
  40. package/dist/cjs/math.js.map +0 -0
  41. package/dist/cjs/order.js +0 -0
  42. package/dist/cjs/order.js.map +0 -0
  43. package/dist/cjs/parse.js +0 -0
  44. package/dist/cjs/parse.js.map +0 -0
  45. package/dist/cjs/patch.js +0 -0
  46. package/dist/cjs/patch.js.map +0 -0
  47. package/dist/cjs/range.js +0 -0
  48. package/dist/cjs/range.js.map +0 -0
  49. package/dist/cjs/stopwatch.js +0 -0
  50. package/dist/cjs/stopwatch.js.map +0 -0
  51. package/dist/cjs/string.js +21 -0
  52. package/dist/cjs/string.js.map +1 -1
  53. package/dist/cjs/timer.js +0 -0
  54. package/dist/cjs/timer.js.map +0 -0
  55. package/dist/cjs/timespan.js +0 -0
  56. package/dist/cjs/timespan.js.map +0 -0
  57. package/dist/cjs/type-code.js +0 -0
  58. package/dist/cjs/type-code.js.map +0 -0
  59. package/dist/cjs/type.js +0 -0
  60. package/dist/cjs/type.js.map +0 -0
  61. package/dist/cjs/types.js +0 -0
  62. package/dist/cjs/types.js.map +1 -1
  63. package/dist/cjs/utilities.js +0 -0
  64. package/dist/cjs/utilities.js.map +0 -0
  65. package/dist/esm/array.js +0 -0
  66. package/dist/esm/array.js.map +0 -0
  67. package/dist/esm/async-pool-executor.js +0 -0
  68. package/dist/esm/async-pool-executor.js.map +0 -0
  69. package/dist/esm/browser/form-utilities.js +0 -0
  70. package/dist/esm/browser/form-utilities.js.map +0 -0
  71. package/dist/esm/browser/geo-location.js +0 -0
  72. package/dist/esm/browser/geo-location.js.map +0 -0
  73. package/dist/esm/browser/index.js +0 -0
  74. package/dist/esm/browser/index.js.map +0 -0
  75. package/dist/esm/browser/native-bridge.js +0 -0
  76. package/dist/esm/browser/native-bridge.js.map +0 -0
  77. package/dist/esm/cancellable-promise.js +0 -0
  78. package/dist/esm/cancellable-promise.js.map +0 -0
  79. package/dist/esm/clean-url-search-params.js +0 -0
  80. package/dist/esm/clean-url-search-params.js.map +0 -0
  81. package/dist/esm/collections/cache-dictionary.js +0 -0
  82. package/dist/esm/collections/cache-dictionary.js.map +0 -0
  83. package/dist/esm/collections/default-map.js +0 -0
  84. package/dist/esm/collections/default-map.js.map +0 -0
  85. package/dist/esm/collections/default-weak-map.js +0 -0
  86. package/dist/esm/collections/default-weak-map.js.map +0 -0
  87. package/dist/esm/collections/from.js +0 -0
  88. package/dist/esm/collections/from.js.map +0 -0
  89. package/dist/esm/collections/index.js +0 -0
  90. package/dist/esm/collections/index.js.map +0 -0
  91. package/dist/esm/draft.js +0 -0
  92. package/dist/esm/draft.js.map +0 -0
  93. package/dist/esm/event-bus.js +0 -0
  94. package/dist/esm/event-bus.js.map +0 -0
  95. package/dist/esm/functions.js +0 -0
  96. package/dist/esm/functions.js.map +0 -0
  97. package/dist/esm/index.js +0 -0
  98. package/dist/esm/index.js.map +0 -0
  99. package/dist/esm/key-value-pair.js +0 -0
  100. package/dist/esm/key-value-pair.js.map +0 -0
  101. package/dist/esm/lazy.js +0 -0
  102. package/dist/esm/lazy.js.map +0 -0
  103. package/dist/esm/math.js +0 -0
  104. package/dist/esm/math.js.map +0 -0
  105. package/dist/esm/order.js +0 -0
  106. package/dist/esm/order.js.map +0 -0
  107. package/dist/esm/parse.js +0 -0
  108. package/dist/esm/parse.js.map +0 -0
  109. package/dist/esm/patch.js +0 -0
  110. package/dist/esm/patch.js.map +0 -0
  111. package/dist/esm/range.js +0 -0
  112. package/dist/esm/range.js.map +0 -0
  113. package/dist/esm/stopwatch.js +0 -0
  114. package/dist/esm/stopwatch.js.map +0 -0
  115. package/dist/esm/string.js +19 -0
  116. package/dist/esm/string.js.map +1 -1
  117. package/dist/esm/timer.js +0 -0
  118. package/dist/esm/timer.js.map +0 -0
  119. package/dist/esm/timespan.js +0 -0
  120. package/dist/esm/timespan.js.map +0 -0
  121. package/dist/esm/type-code.js +0 -0
  122. package/dist/esm/type-code.js.map +0 -0
  123. package/dist/esm/type.js +0 -0
  124. package/dist/esm/type.js.map +0 -0
  125. package/dist/esm/types.js +0 -0
  126. package/dist/esm/types.js.map +1 -1
  127. package/dist/esm/utilities.js +0 -0
  128. package/dist/esm/utilities.js.map +0 -0
  129. package/dist/types/array.d.ts +0 -0
  130. package/dist/types/array.d.ts.map +0 -0
  131. package/dist/types/async-pool-executor.d.ts +0 -0
  132. package/dist/types/async-pool-executor.d.ts.map +0 -0
  133. package/dist/types/browser/form-utilities.d.ts +0 -0
  134. package/dist/types/browser/form-utilities.d.ts.map +0 -0
  135. package/dist/types/browser/geo-location.d.ts +0 -0
  136. package/dist/types/browser/geo-location.d.ts.map +0 -0
  137. package/dist/types/browser/index.d.ts +0 -0
  138. package/dist/types/browser/index.d.ts.map +0 -0
  139. package/dist/types/browser/native-bridge.d.ts +0 -0
  140. package/dist/types/browser/native-bridge.d.ts.map +0 -0
  141. package/dist/types/cancellable-promise.d.ts +0 -0
  142. package/dist/types/cancellable-promise.d.ts.map +0 -0
  143. package/dist/types/clean-url-search-params.d.ts +0 -0
  144. package/dist/types/clean-url-search-params.d.ts.map +0 -0
  145. package/dist/types/collections/cache-dictionary.d.ts +0 -0
  146. package/dist/types/collections/cache-dictionary.d.ts.map +0 -0
  147. package/dist/types/collections/default-map.d.ts +0 -0
  148. package/dist/types/collections/default-map.d.ts.map +0 -0
  149. package/dist/types/collections/default-weak-map.d.ts +0 -0
  150. package/dist/types/collections/default-weak-map.d.ts.map +0 -0
  151. package/dist/types/collections/from.d.ts +0 -0
  152. package/dist/types/collections/from.d.ts.map +0 -0
  153. package/dist/types/collections/index.d.ts +0 -0
  154. package/dist/types/collections/index.d.ts.map +0 -0
  155. package/dist/types/draft.d.ts +0 -0
  156. package/dist/types/draft.d.ts.map +0 -0
  157. package/dist/types/event-bus.d.ts +0 -0
  158. package/dist/types/event-bus.d.ts.map +0 -0
  159. package/dist/types/functions.d.ts +0 -0
  160. package/dist/types/functions.d.ts.map +0 -0
  161. package/dist/types/index.d.ts +0 -0
  162. package/dist/types/index.d.ts.map +0 -0
  163. package/dist/types/key-value-pair.d.ts +0 -0
  164. package/dist/types/key-value-pair.d.ts.map +0 -0
  165. package/dist/types/lazy.d.ts +0 -0
  166. package/dist/types/lazy.d.ts.map +0 -0
  167. package/dist/types/math.d.ts +0 -0
  168. package/dist/types/math.d.ts.map +0 -0
  169. package/dist/types/order.d.ts +0 -0
  170. package/dist/types/order.d.ts.map +0 -0
  171. package/dist/types/parse.d.ts +0 -0
  172. package/dist/types/parse.d.ts.map +0 -0
  173. package/dist/types/patch.d.ts +0 -0
  174. package/dist/types/patch.d.ts.map +0 -0
  175. package/dist/types/range.d.ts +0 -0
  176. package/dist/types/range.d.ts.map +0 -0
  177. package/dist/types/stopwatch.d.ts +0 -0
  178. package/dist/types/stopwatch.d.ts.map +0 -0
  179. package/dist/types/string.d.ts +11 -0
  180. package/dist/types/string.d.ts.map +1 -1
  181. package/dist/types/timer.d.ts +0 -0
  182. package/dist/types/timer.d.ts.map +0 -0
  183. package/dist/types/timespan.d.ts +0 -0
  184. package/dist/types/timespan.d.ts.map +0 -0
  185. package/dist/types/type-code.d.ts +0 -0
  186. package/dist/types/type-code.d.ts.map +0 -0
  187. package/dist/types/type.d.ts +0 -0
  188. package/dist/types/type.d.ts.map +0 -0
  189. package/dist/types/types.d.ts +0 -0
  190. package/dist/types/types.d.ts.map +1 -1
  191. package/dist/types/utilities.d.ts +0 -0
  192. package/dist/types/utilities.d.ts.map +0 -0
  193. package/dist/web/array.js +0 -0
  194. package/dist/web/array.js.map +0 -0
  195. package/dist/web/async-pool-executor.js +0 -0
  196. package/dist/web/async-pool-executor.js.map +0 -0
  197. package/dist/web/browser/form-utilities.js +0 -0
  198. package/dist/web/browser/form-utilities.js.map +0 -0
  199. package/dist/web/browser/geo-location.js +0 -0
  200. package/dist/web/browser/geo-location.js.map +0 -0
  201. package/dist/web/browser/index.js +0 -0
  202. package/dist/web/browser/index.js.map +0 -0
  203. package/dist/web/browser/native-bridge.js +0 -0
  204. package/dist/web/browser/native-bridge.js.map +0 -0
  205. package/dist/web/cancellable-promise.js +0 -0
  206. package/dist/web/cancellable-promise.js.map +0 -0
  207. package/dist/web/clean-url-search-params.js +0 -0
  208. package/dist/web/clean-url-search-params.js.map +0 -0
  209. package/dist/web/collections/cache-dictionary.js +0 -0
  210. package/dist/web/collections/cache-dictionary.js.map +0 -0
  211. package/dist/web/collections/default-map.js +0 -0
  212. package/dist/web/collections/default-map.js.map +0 -0
  213. package/dist/web/collections/default-weak-map.js +0 -0
  214. package/dist/web/collections/default-weak-map.js.map +0 -0
  215. package/dist/web/collections/from.js +0 -0
  216. package/dist/web/collections/from.js.map +0 -0
  217. package/dist/web/collections/index.js +0 -0
  218. package/dist/web/collections/index.js.map +0 -0
  219. package/dist/web/draft.js +0 -0
  220. package/dist/web/draft.js.map +0 -0
  221. package/dist/web/event-bus.js +0 -0
  222. package/dist/web/event-bus.js.map +0 -0
  223. package/dist/web/functions.js +0 -0
  224. package/dist/web/functions.js.map +0 -0
  225. package/dist/web/index.js +0 -0
  226. package/dist/web/index.js.map +0 -0
  227. package/dist/web/key-value-pair.js +0 -0
  228. package/dist/web/key-value-pair.js.map +0 -0
  229. package/dist/web/lazy.js +0 -0
  230. package/dist/web/lazy.js.map +0 -0
  231. package/dist/web/math.js +0 -0
  232. package/dist/web/math.js.map +0 -0
  233. package/dist/web/order.js +0 -0
  234. package/dist/web/order.js.map +0 -0
  235. package/dist/web/parse.js +0 -0
  236. package/dist/web/parse.js.map +0 -0
  237. package/dist/web/patch.js +0 -0
  238. package/dist/web/patch.js.map +0 -0
  239. package/dist/web/range.js +0 -0
  240. package/dist/web/range.js.map +0 -0
  241. package/dist/web/stopwatch.js +0 -0
  242. package/dist/web/stopwatch.js.map +0 -0
  243. package/dist/web/string.js +19 -0
  244. package/dist/web/string.js.map +1 -1
  245. package/dist/web/timer.js +0 -0
  246. package/dist/web/timer.js.map +0 -0
  247. package/dist/web/timespan.js +0 -0
  248. package/dist/web/timespan.js.map +0 -0
  249. package/dist/web/type-code.js +0 -0
  250. package/dist/web/type-code.js.map +0 -0
  251. package/dist/web/type.js +0 -0
  252. package/dist/web/type.js.map +0 -0
  253. package/dist/web/types.js +0 -0
  254. package/dist/web/types.js.map +1 -1
  255. package/dist/web/utilities.js +0 -0
  256. package/dist/web/utilities.js.map +0 -0
  257. package/package.json +19 -1
  258. package/src/string.ts +22 -1
  259. package/src/types.ts +4 -0
@@ -14,6 +14,17 @@ export declare function ensurePrefix(str: string, prefix: string): string;
14
14
  * @return {string} - The modified string with the suffix added if it was not already present.
15
15
  */
16
16
  export declare function ensureSuffix(str: string, suffix: string): string;
17
+ /**
18
+ * Normalizes Unicode whitespaces into single ASCII spaces and removes leading
19
+ * and trailing whitespace.
20
+ */
21
+ export declare function normalizeWhitespaces(str: string): string;
22
+ /**
23
+ * Removes Unicode diacritics while preserving the original letter casing.
24
+ *
25
+ * @example removeDiacritics('áÁñÑ') // 'aAnN'
26
+ */
27
+ export declare function removeDiacritics(str: string): string;
17
28
  /**
18
29
  * Formats a string using a template and provided arguments.
19
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/string.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIhE;AAGD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAgB/D;AA0BD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH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AElD"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;AAEhE,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAA;AAE1C,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;AAE/C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAElC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEnC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEvC,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEzD,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AAEhD,MAAM,MAAM,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;AAElE,MAAM,MAAM,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;AAEjF,MAAM,MAAM,kBAAkB,CAAC,EAAE,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AElE,MAAM,MAAM,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;AAEjF,MAAM,MAAM,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAChD,IAAI,EAAE,EAAE,EACR,IAAI,EAAE,EAAE,EACR,IAAI,EAAE,EAAE,EACR,IAAI,EAAE,EAAE,KACP,CAAC,CAAC;AAEP,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC"}
File without changes
File without changes
package/dist/web/array.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/web/draft.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/web/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/dist/web/lazy.js CHANGED
File without changes
File without changes
package/dist/web/math.js CHANGED
File without changes
File without changes
package/dist/web/order.js CHANGED
File without changes
File without changes
package/dist/web/parse.js CHANGED
File without changes
File without changes
package/dist/web/patch.js CHANGED
File without changes
File without changes
package/dist/web/range.js CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -22,6 +22,25 @@ export function ensureSuffix(str, suffix) {
22
22
  return str + suffix;
23
23
  return str;
24
24
  }
25
+ /**
26
+ * Normalizes Unicode whitespaces into single ASCII spaces and removes leading
27
+ * and trailing whitespace.
28
+ */
29
+ export function normalizeWhitespaces(str) {
30
+ return str.normalize('NFKC')
31
+ .replace(/[\s\u200B\uFEFF]+/gu, ' ')
32
+ .trim();
33
+ }
34
+ /**
35
+ * Removes Unicode diacritics while preserving the original letter casing.
36
+ *
37
+ * @example removeDiacritics('áÁñÑ') // 'aAnN'
38
+ */
39
+ export function removeDiacritics(str) {
40
+ return str
41
+ .normalize('NFD')
42
+ .replace(/\p{M}+/gu, '');
43
+ }
25
44
  /**
26
45
  * Formats a string using a template and provided arguments.
27
46
  *
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/string.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,MAAc;IACpD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;QACvB,OAAO,MAAM,GAAG,GAAG,CAAA;IACvB,OAAO,GAAG,CAAA;AACd,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,MAAc;IACpD,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;QACrB,OAAO,GAAG,GAAG,MAAM,CAAA;IACvB,OAAO,GAAG,CAAA;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,QAAgB,EAAE,GAAG,IAAW;IAEnD,IAAI,KAAa,CAAC;IAClB,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,oBAAoB,EAAE,CAAC;QAC/F,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACf,KAAK,GAAG,UAAU,CAAC;IACvB,CAAC;SAAM,CAAC;QACJ,KAAK,GAAG,WAAW,CAAC;IACxB,CAAC;IAED,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,E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I,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC/E,IAAI,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC;SACd,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACzD,IAAI,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACtC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAChD,CAAC","sourcesContent":["\n/**\n * Ensures that a given string has a specific prefix.\n *\n * @param {string} str - The string to ensure the prefix on.\n * @param {string} prefix - The prefix to ensure on the string.\n * @return {string} - The resulting string with the ensured prefix.\n */\nexport function ensurePrefix(str: string, prefix: string): string {\n if (!str.startsWith(prefix))\n return prefix + str\n return str\n}\n\n\n/**\n * Ensures that a string ends with a specified suffix.\n *\n * @param {string} str - The original string.\n * @param {string} suffix - The suffix to ensure.\n * @return {string} - The modified string with the suffix added if it was not already present.\n */\nexport function ensureSuffix(str: string, suffix: string): string {\n if (!str.endsWith(suffix))\n return str + suffix\n return str\n}\n\n/**\n * Formats a string using a template and provided arguments.\n *\n * @param {string} template - The template string containing placeholders.\n * @param {any[]} args - Optional arguments to replace the placeholders in the template.\n * @return {string} The formatted string.\n */\nexport function format(template: string, ...args: any[]): string {\n\n let regex: RegExp;\n const hasNamedPlaceholders = /{(?!\\d+})[^{}]+}/.test(template);\n if (args.length === 1 && args[0] !== null && typeof args[0] === 'object' && hasNamedPlaceholders) {\n args = args[0];\n regex = /{(.+?)}/g;\n } else {\n regex = /{(\\d+?)}/g;\n }\n\n return template.replace(regex, (match, key) => {\n return Object.prototype.hasOwnProperty.call(args, key) && typeof args[key] !== 'undefined'\n ? args[key]\n : \"\";\n });\n}\n\n/**\n * Splits a string into its constituent words, regardless of the original case\n * style (camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE,\n * space-separated, etc.).\n *\n * @param {string} str - The string to split into words.\n * @return {string[]} - The list of lowercase words extracted from the input.\n */\nfunction toWords(str: string): string[] {\n if (!str) return [];\n\n return str\n // Insert a space between a lowercase/digit and an uppercase letter (camelCase -> camel Case)\n .replace(/([\\p{Ll}\\p{N}])(\\p{Lu})/gu, '$1 $2')\n // Insert a space between consecutive uppercase letters followed by a lowercase letter (XMLParser -> XML Parser)\n .replace(/(\\p{Lu}+)(\\p{Lu}\\p{Ll})/gu, '$1 $2')\n // Replace any non-alphanumeric character with a space\n .replace(/[^\\p{L}\\p{N}]+/gu, ' ')\n .trim()\n .toLowerCase()\n .split(/\\s+/)\n .filter(Boolean);\n}\n\n/**\n * Converts a string to snake_case.\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to snake_case.\n */\nexport function toSnakeCase(str: string): string {\n return toWords(str).join('_');\n}\n\n/**\n * Converts a string to kebab-case.\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to kebab-case.\n */\nexport function toKebabCase(str: string): string {\n return toWords(str).join('-');\n}\n\n/**\n * Converts a string to camelCase.\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to camelCase.\n */\nexport function toCamelCase(str: string): string {\n const words = toWords(str);\n if (words.length === 0) return '';\n return words\n .map((word, i) => i === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n}\n\n/**\n * Converts a string to PascalCase.\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to PascalCase.\n */\nexport function toPascalCase(str: string): string {\n return toWords(str)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n}\n\n/**\n * Converts a string to CONSTANT_CASE (a.k.a. SCREAMING_SNAKE_CASE).\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to CONSTANT_CASE.\n */\nexport function toConstantCase(str: string): string {\n return toWords(str).join('_').toUpperCase();\n}"]}
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/string.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,MAAc;IACpD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;QACvB,OAAO,MAAM,GAAG,GAAG,CAAA;IACvB,OAAO,GAAG,CAAA;AACd,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,MAAc;IACpD,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;QACrB,OAAO,GAAG,GAAG,MAAM,CAAA;IACvB,OAAO,GAAG,CAAA;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC5C,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,qBAAqB,EAAE,GAAG,CAAC;SACnC,IAAI,EAAE,CAAA;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IACxC,OAAO,GAAG;SACL,SAAS,CAAC,KAAK,CAAC;SAChB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AAChC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,QAAgB,EAAE,GAAG,IAAW;IAEnD,IAAI,KAAa,CAAC;IAClB,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,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;IACnC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,OAAO,KAAK;SACP,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC/E,IAAI,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC;SACd,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACzD,IAAI,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACtC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAChD,CAAC","sourcesContent":["\n/**\n * Ensures that a given string has a specific prefix.\n *\n * @param {string} str - The string to ensure the prefix on.\n * @param {string} prefix - The prefix to ensure on the string.\n * @return {string} - The resulting string with the ensured prefix.\n */\nexport function ensurePrefix(str: string, prefix: string): string {\n if (!str.startsWith(prefix))\n return prefix + str\n return str\n}\n\n\n/**\n * Ensures that a string ends with a specified suffix.\n *\n * @param {string} str - The original string.\n * @param {string} suffix - The suffix to ensure.\n * @return {string} - The modified string with the suffix added if it was not already present.\n */\nexport function ensureSuffix(str: string, suffix: string): string {\n if (!str.endsWith(suffix))\n return str + suffix\n return str\n}\n\n/**\n * Normalizes Unicode whitespaces into single ASCII spaces and removes leading\n * and trailing whitespace.\n */\nexport function normalizeWhitespaces(str: string): string {\n return str.normalize('NFKC')\n .replace(/[\\s\\u200B\\uFEFF]+/gu, ' ')\n .trim()\n}\n\n/**\n * Removes Unicode diacritics while preserving the original letter casing.\n *\n * @example removeDiacritics('áÁñÑ') // 'aAnN'\n */\nexport function removeDiacritics(str: string): string {\n return str\n .normalize('NFD')\n .replace(/\\p{M}+/gu, '')\n}\n\n/**\n * Formats a string using a template and provided arguments.\n *\n * @param {string} template - The template string containing placeholders.\n * @param {any[]} args - Optional arguments to replace the placeholders in the template.\n * @return {string} The formatted string.\n */\nexport function format(template: string, ...args: any[]): string {\n\n let regex: RegExp;\n const hasNamedPlaceholders = /{(?!\\d+})[^{}]+}/.test(template);\n if (args.length === 1 && args[0] !== null && typeof args[0] === 'object' && hasNamedPlaceholders) {\n args = args[0];\n regex = /{(.+?)}/g;\n } else {\n regex = /{(\\d+?)}/g;\n }\n\n return template.replace(regex, (match, key) => {\n return Object.prototype.hasOwnProperty.call(args, key) && typeof args[key] !== 'undefined'\n ? args[key]\n : \"\";\n });\n}\n\n/**\n * Splits a string into its constituent words, regardless of the original case\n * style (camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE,\n * space-separated, etc.).\n *\n * @param {string} str - The string to split into words.\n * @return {string[]} - The list of lowercase words extracted from the input.\n */\nfunction toWords(str: string): string[] {\n if (!str) return [];\n\n return str\n // Insert a space between a lowercase/digit and an uppercase letter (camelCase -> camel Case)\n .replace(/([\\p{Ll}\\p{N}])(\\p{Lu})/gu, '$1 $2')\n // Insert a space between consecutive uppercase letters followed by a lowercase letter (XMLParser -> XML Parser)\n .replace(/(\\p{Lu}+)(\\p{Lu}\\p{Ll})/gu, '$1 $2')\n // Replace any non-alphanumeric character with a space\n .replace(/[^\\p{L}\\p{N}]+/gu, ' ')\n .trim()\n .toLowerCase()\n .split(/\\s+/)\n .filter(Boolean);\n}\n\n/**\n * Converts a string to snake_case.\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to snake_case.\n */\nexport function toSnakeCase(str: string): string {\n return toWords(str).join('_');\n}\n\n/**\n * Converts a string to kebab-case.\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to kebab-case.\n */\nexport function toKebabCase(str: string): string {\n return toWords(str).join('-');\n}\n\n/**\n * Converts a string to camelCase.\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to camelCase.\n */\nexport function toCamelCase(str: string): string {\n const words = toWords(str);\n if (words.length === 0) return '';\n return words\n .map((word, i) => i === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n}\n\n/**\n * Converts a string to PascalCase.\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to PascalCase.\n */\nexport function toPascalCase(str: string): string {\n return toWords(str)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n}\n\n/**\n * Converts a string to CONSTANT_CASE (a.k.a. SCREAMING_SNAKE_CASE).\n *\n * @param {string} str - The string to convert.\n * @return {string} - The string converted to CONSTANT_CASE.\n */\nexport function toConstantCase(str: string): string {\n return toWords(str).join('_').toUpperCase();\n}\n"]}
package/dist/web/timer.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/web/type.js CHANGED
File without changes
File without changes
package/dist/web/types.js CHANGED
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type EqualityComparer<T> = (arg1: T, arg2: T) => boolean;\n\nexport type Consumer<T> = (arg: T) => void\n\nexport type Predicate<T> = (arg: T) => boolean;\n\nexport type Supplier<T> = () => T;\n\nexport type Nullable<T> = T | null;\n\nexport type Optional<T> = T | undefined;\n\nexport type Nullish = null | undefined;\n\nexport type Resolvable<T> = T | Promise<T> | Supplier<T>;\n\nexport type UnaryFunction<T, R> = (arg: T) => R;\n\nexport type BinaryFunction<T1, T2, R> = (arg1: T1, arg2: T2) => R;\n\nexport type TernaryFunction<T1, T2, T3, R> = (arg1: T1, arg2: T2, arg3: T3) => R;\n\nexport type QuaternaryFunction<T1, T2, T3, T4, R> = (\n arg1: T1,\n arg2: T2,\n arg3: T3,\n arg4: T4\n) => R;\n\nexport type Constructor<T = unknown> = abstract new (...args: any[]) => T;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["\n\nexport type EqualityComparer<T> = (arg1: T, arg2: T) => boolean;\n\nexport type Consumer<T> = (arg: T) => void\n\nexport type Predicate<T> = (arg: T) => boolean;\n\nexport type Supplier<T> = () => T;\n\nexport type Nullable<T> = T | null;\n\nexport type Optional<T> = T | undefined;\n\nexport type Nullish = null | undefined;\n\nexport type Resolvable<T> = T | Promise<T> | Supplier<T>;\n\nexport type UnaryFunction<T, R> = (arg: T) => R;\n\nexport type BinaryFunction<T1, T2, R> = (arg1: T1, arg2: T2) => R;\n\nexport type TernaryFunction<T1, T2, T3, R> = (arg1: T1, arg2: T2, arg3: T3) => R;\n\nexport type QuaternaryFunction<T1, T2, T3, T4, R> = (\n arg1: T1,\n arg2: T2,\n arg3: T3,\n arg4: T4\n) => R;\n\nexport type Constructor<T = unknown> = abstract new (...args: any[]) => T;\n\n\n"]}
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develia/commons",
3
- "version": "0.4.18",
3
+ "version": "0.4.20",
4
4
  "author": {
5
5
  "name": "Antonio Gil Espinosa",
6
6
  "email": "antonio.gil.espinosa@gmail.com",
@@ -29,6 +29,24 @@
29
29
  "require": "./dist/cjs/functions.js",
30
30
  "browser": "./dist/web/functions.js"
31
31
  },
32
+ "./utilities": {
33
+ "types": "./dist/types/utilities.d.ts",
34
+ "import": "./dist/esm/utilities.js",
35
+ "require": "./dist/cjs/utilities.js",
36
+ "browser": "./dist/web/utilities.js"
37
+ },
38
+ "./string": {
39
+ "types": "./dist/types/string.d.ts",
40
+ "import": "./dist/esm/string.js",
41
+ "require": "./dist/cjs/string.js",
42
+ "browser": "./dist/web/string.js"
43
+ },
44
+ "./math": {
45
+ "types": "./dist/types/math.d.ts",
46
+ "import": "./dist/esm/math.js",
47
+ "require": "./dist/cjs/math.js",
48
+ "browser": "./dist/web/math.js"
49
+ },
32
50
  "./collections": {
33
51
  "types": "./dist/types/collections/index.d.ts",
34
52
  "import": "./dist/esm/collections/index.js",
package/src/string.ts CHANGED
@@ -26,6 +26,27 @@ export function ensureSuffix(str: string, suffix: string): string {
26
26
  return str
27
27
  }
28
28
 
29
+ /**
30
+ * Normalizes Unicode whitespaces into single ASCII spaces and removes leading
31
+ * and trailing whitespace.
32
+ */
33
+ export function normalizeWhitespaces(str: string): string {
34
+ return str.normalize('NFKC')
35
+ .replace(/[\s\u200B\uFEFF]+/gu, ' ')
36
+ .trim()
37
+ }
38
+
39
+ /**
40
+ * Removes Unicode diacritics while preserving the original letter casing.
41
+ *
42
+ * @example removeDiacritics('áÁñÑ') // 'aAnN'
43
+ */
44
+ export function removeDiacritics(str: string): string {
45
+ return str
46
+ .normalize('NFD')
47
+ .replace(/\p{M}+/gu, '')
48
+ }
49
+
29
50
  /**
30
51
  * Formats a string using a template and provided arguments.
31
52
  *
@@ -129,4 +150,4 @@ export function toPascalCase(str: string): string {
129
150
  */
130
151
  export function toConstantCase(str: string): string {
131
152
  return toWords(str).join('_').toUpperCase();
132
- }
153
+ }
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  export type EqualityComparer<T> = (arg1: T, arg2: T) => boolean;
2
4
 
3
5
  export type Consumer<T> = (arg: T) => void
@@ -28,3 +30,5 @@ export type QuaternaryFunction<T1, T2, T3, T4, R> = (
28
30
  ) => R;
29
31
 
30
32
  export type Constructor<T = unknown> = abstract new (...args: any[]) => T;
33
+
34
+