umt 2.5.0 → 2.6.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 (268) hide show
  1. package/README.md +11 -0
  2. package/module/Array/generateNumberArray.js +13 -7
  3. package/module/Array/generateNumberArray.js.map +1 -1
  4. package/module/Array/getArraysCommon.js +21 -3
  5. package/module/Array/getArraysCommon.js.map +1 -1
  6. package/module/Array/groupBy.js +1 -1
  7. package/module/Array/groupBy.js.map +1 -1
  8. package/module/Array/index.d.ts +2 -0
  9. package/module/Array/index.js +2 -0
  10. package/module/Array/index.js.map +1 -1
  11. package/module/Array/ultraNumberSort.js +2 -2
  12. package/module/Array/ultraNumberSort.js.map +1 -1
  13. package/module/Array/uniqBy.d.ts +7 -0
  14. package/module/Array/uniqBy.js +19 -0
  15. package/module/Array/uniqBy.js.map +1 -0
  16. package/module/Array/unique.d.ts +6 -0
  17. package/module/Array/unique.js +9 -0
  18. package/module/Array/unique.js.map +1 -0
  19. package/module/Color/rgbaToHsla.js +1 -1
  20. package/module/Color/rgbaToHsla.js.map +1 -1
  21. package/module/Date/birthday.js +14 -6
  22. package/module/Date/birthday.js.map +1 -1
  23. package/module/Date/isLeapYear.js +3 -0
  24. package/module/Date/isLeapYear.js.map +1 -1
  25. package/module/Error/index.d.ts +1 -0
  26. package/module/Error/index.js +1 -0
  27. package/module/Error/index.js.map +1 -1
  28. package/module/Error/retry.d.ts +37 -0
  29. package/module/Error/retry.js +47 -0
  30. package/module/Error/retry.js.map +1 -0
  31. package/module/IP/getIpClass.js +1 -1
  32. package/module/IP/getIpClass.js.map +1 -1
  33. package/module/IP/getNetworkAddress.js +2 -2
  34. package/module/IP/getNetworkAddress.js.map +1 -1
  35. package/module/IP/ipToBinaryString.js +2 -2
  36. package/module/IP/ipToBinaryString.js.map +1 -1
  37. package/module/IP/subnetMaskToCidr.js +1 -1
  38. package/module/IP/subnetMaskToCidr.js.map +1 -1
  39. package/module/Math/calculator/core.js +21 -13
  40. package/module/Math/calculator/core.js.map +1 -1
  41. package/module/Math/calculator/literalExpression.js +19 -7
  42. package/module/Math/calculator/literalExpression.js.map +1 -1
  43. package/module/Math/division.js +3 -3
  44. package/module/Math/division.js.map +1 -1
  45. package/module/Math/gcd.js +26 -4
  46. package/module/Math/gcd.js.map +1 -1
  47. package/module/Math/standardDeviation.js +4 -2
  48. package/module/Math/standardDeviation.js.map +1 -1
  49. package/module/Object/has.js +1 -2
  50. package/module/Object/has.js.map +1 -1
  51. package/module/Object/index.d.ts +4 -0
  52. package/module/Object/index.js +4 -0
  53. package/module/Object/index.js.map +1 -1
  54. package/module/Object/isEmpty.d.ts +6 -0
  55. package/module/Object/isEmpty.js +20 -0
  56. package/module/Object/isEmpty.js.map +1 -0
  57. package/module/Object/merge.d.ts +8 -0
  58. package/module/Object/merge.js +10 -0
  59. package/module/Object/merge.js.map +1 -0
  60. package/module/Object/mergeDeep.d.ts +8 -0
  61. package/module/Object/mergeDeep.js +37 -0
  62. package/module/Object/mergeDeep.js.map +1 -0
  63. package/module/Object/omit.d.ts +7 -0
  64. package/module/Object/omit.js +14 -0
  65. package/module/Object/omit.js.map +1 -0
  66. package/module/Object/pickDeep.d.ts +2 -2
  67. package/module/Object/pickDeep.js +4 -4
  68. package/module/Object/pickDeep.js.map +1 -1
  69. package/module/Simple/Date/dayOfWeekSimple.js +3 -3
  70. package/module/Simple/Date/dayOfWeekSimple.js.map +1 -1
  71. package/module/String/camelCase.d.ts +6 -0
  72. package/module/String/camelCase.js +12 -0
  73. package/module/String/camelCase.js.map +1 -0
  74. package/module/String/escapeHtml.d.ts +6 -0
  75. package/module/String/escapeHtml.js +19 -0
  76. package/module/String/escapeHtml.js.map +1 -0
  77. package/module/String/formatString/applyFormatter.d.ts +25 -0
  78. package/module/String/formatString/applyFormatter.js +71 -0
  79. package/module/String/formatString/applyFormatter.js.map +1 -0
  80. package/module/String/formatString/defaultFormatters.d.ts +24 -0
  81. package/module/String/formatString/defaultFormatters.js +59 -0
  82. package/module/String/formatString/defaultFormatters.js.map +1 -0
  83. package/module/String/formatString/detectMode.d.ts +26 -0
  84. package/module/String/formatString/detectMode.js +61 -0
  85. package/module/String/formatString/detectMode.js.map +1 -0
  86. package/module/String/formatString/getValue.d.ts +27 -0
  87. package/module/String/formatString/getValue.js +56 -0
  88. package/module/String/formatString/getValue.js.map +1 -0
  89. package/module/String/formatString/index.d.ts +91 -0
  90. package/module/String/formatString/index.js +38 -0
  91. package/module/String/formatString/index.js.map +1 -0
  92. package/module/String/index.d.ts +5 -0
  93. package/module/String/index.js +5 -0
  94. package/module/String/index.js.map +1 -1
  95. package/module/String/kebabCase.d.ts +6 -0
  96. package/module/String/kebabCase.js +22 -0
  97. package/module/String/kebabCase.js.map +1 -0
  98. package/module/String/levenshteinDistance.d.ts +8 -0
  99. package/module/String/levenshteinDistance.js +38 -0
  100. package/module/String/levenshteinDistance.js.map +1 -0
  101. package/module/String/stringSimilarity.d.ts +8 -0
  102. package/module/String/stringSimilarity.js +23 -0
  103. package/module/String/stringSimilarity.js.map +1 -0
  104. package/module/Validate/core/index.js +0 -1
  105. package/module/Validate/core/index.js.map +1 -1
  106. package/module/Validate/isDouble.js +1 -1
  107. package/module/Validate/isDouble.js.map +1 -1
  108. package/module/Validate/isNode.js +1 -0
  109. package/module/Validate/isNode.js.map +1 -1
  110. package/module/Validate/isNumber.js +1 -1
  111. package/module/Validate/isNumber.js.map +1 -1
  112. package/module/Validate/isValueNaN.js +1 -1
  113. package/module/Validate/isValueNaN.js.map +1 -1
  114. package/module/Validate/number/even.js +7 -1
  115. package/module/Validate/number/even.js.map +1 -1
  116. package/module/Validate/number/odd.js +7 -1
  117. package/module/Validate/number/odd.js.map +1 -1
  118. package/module/Validate/string/email.js +20 -2
  119. package/module/Validate/string/email.js.map +1 -1
  120. package/module/es5/Array/generateNumberArray.js +15 -9
  121. package/module/es5/Array/getArraysCommon.js +39 -4
  122. package/module/es5/Array/groupBy.js +1 -1
  123. package/module/es5/Array/index.d.ts +2 -0
  124. package/module/es5/Array/index.js +22 -0
  125. package/module/es5/Array/ultraNumberSort.js +2 -2
  126. package/module/es5/Array/uniqBy.d.ts +7 -0
  127. package/module/es5/Array/uniqBy.js +36 -0
  128. package/module/es5/Array/unique.d.ts +6 -0
  129. package/module/es5/Array/unique.js +20 -0
  130. package/module/es5/Color/rgbaToHsla.js +1 -1
  131. package/module/es5/Date/birthday.js +17 -3
  132. package/module/es5/Date/isLeapYear.js +3 -0
  133. package/module/es5/Error/index.d.ts +1 -0
  134. package/module/es5/Error/index.js +11 -0
  135. package/module/es5/Error/retry.d.ts +37 -0
  136. package/module/es5/Error/retry.js +88 -0
  137. package/module/es5/IP/getIpClass.js +1 -1
  138. package/module/es5/IP/getNetworkAddress.js +2 -2
  139. package/module/es5/IP/ipToBinaryString.js +2 -2
  140. package/module/es5/IP/subnetMaskToCidr.js +1 -1
  141. package/module/es5/Math/calculator/core.js +17 -9
  142. package/module/es5/Math/calculator/literalExpression.js +19 -6
  143. package/module/es5/Math/division.js +3 -3
  144. package/module/es5/Math/gcd.js +43 -5
  145. package/module/es5/Math/standardDeviation.js +4 -2
  146. package/module/es5/Object/has.js +1 -1
  147. package/module/es5/Object/index.d.ts +4 -0
  148. package/module/es5/Object/index.js +44 -0
  149. package/module/es5/Object/isEmpty.d.ts +6 -0
  150. package/module/es5/Object/isEmpty.js +26 -0
  151. package/module/es5/Object/merge.d.ts +8 -0
  152. package/module/es5/Object/merge.js +18 -0
  153. package/module/es5/Object/mergeDeep.d.ts +8 -0
  154. package/module/es5/Object/mergeDeep.js +46 -0
  155. package/module/es5/Object/omit.d.ts +7 -0
  156. package/module/es5/Object/omit.js +29 -0
  157. package/module/es5/Object/pickDeep.d.ts +2 -2
  158. package/module/es5/Object/pickDeep.js +4 -4
  159. package/module/es5/Simple/Date/dayOfWeekSimple.js +3 -3
  160. package/module/es5/String/camelCase.d.ts +6 -0
  161. package/module/es5/String/camelCase.js +18 -0
  162. package/module/es5/String/escapeHtml.d.ts +6 -0
  163. package/module/es5/String/escapeHtml.js +27 -0
  164. package/module/es5/String/formatString/applyFormatter.d.ts +25 -0
  165. package/module/es5/String/formatString/applyFormatter.js +100 -0
  166. package/module/es5/String/formatString/defaultFormatters.d.ts +24 -0
  167. package/module/es5/String/formatString/defaultFormatters.js +79 -0
  168. package/module/es5/String/formatString/detectMode.d.ts +26 -0
  169. package/module/es5/String/formatString/detectMode.js +60 -0
  170. package/module/es5/String/formatString/getValue.d.ts +27 -0
  171. package/module/es5/String/formatString/getValue.js +85 -0
  172. package/module/es5/String/formatString/index.d.ts +91 -0
  173. package/module/es5/String/formatString/index.js +152 -0
  174. package/module/es5/String/index.d.ts +5 -0
  175. package/module/es5/String/index.js +55 -0
  176. package/module/es5/String/kebabCase.d.ts +6 -0
  177. package/module/es5/String/kebabCase.js +26 -0
  178. package/module/es5/String/levenshteinDistance.d.ts +8 -0
  179. package/module/es5/String/levenshteinDistance.js +58 -0
  180. package/module/es5/String/stringSimilarity.d.ts +8 -0
  181. package/module/es5/String/stringSimilarity.js +30 -0
  182. package/module/es5/Validate/core/index.js +0 -1
  183. package/module/es5/Validate/isDouble.js +1 -1
  184. package/module/es5/Validate/isNode.js +1 -0
  185. package/module/es5/Validate/isNumber.js +1 -1
  186. package/module/es5/Validate/isValueNaN.js +1 -1
  187. package/module/es5/Validate/number/even.js +4 -0
  188. package/module/es5/Validate/number/odd.js +4 -0
  189. package/module/es5/Validate/string/email.js +26 -1
  190. package/module/es5/tsconfig.tsbuildinfo +1 -1
  191. package/module/es5/types/index.d.ts +1 -0
  192. package/module/es5/types/index.js +11 -0
  193. package/module/es5/types/logic/deepPartial.d.ts +37 -0
  194. package/module/es5/types/logic/deepPartial.js +5 -0
  195. package/module/es5/types/logic/deepRequired.d.ts +37 -0
  196. package/module/es5/types/logic/deepRequired.js +5 -0
  197. package/module/es5/types/logic/index.d.ts +3 -0
  198. package/module/es5/types/logic/index.js +33 -0
  199. package/module/es5/types/logic/unionToIntersection.d.ts +12 -0
  200. package/module/es5/types/logic/unionToIntersection.js +5 -0
  201. package/module/es5/types/object/index.d.ts +1 -0
  202. package/module/es5/types/object/index.js +11 -0
  203. package/module/es5/types/object/pickDeep.d.ts +13 -1
  204. package/module/es5/types/object/shallowObjectValue.d.ts +9 -0
  205. package/module/es5/types/object/shallowObjectValue.js +5 -0
  206. package/module/es5/types/string/formatString/formatData.d.ts +17 -0
  207. package/module/es5/types/string/formatString/formatData.js +5 -0
  208. package/module/es5/types/string/formatString/formatOptions.d.ts +21 -0
  209. package/module/es5/types/string/formatString/formatOptions.js +5 -0
  210. package/module/es5/types/string/formatString/formatString.d.ts +4 -0
  211. package/module/es5/types/string/formatString/formatString.js +49 -0
  212. package/module/es5/types/string/formatString/formatValue.d.ts +15 -0
  213. package/module/es5/types/string/formatString/formatValue.js +5 -0
  214. package/module/es5/types/string/formatString/formatter.d.ts +13 -0
  215. package/module/es5/types/string/formatString/formatter.js +5 -0
  216. package/module/es5/types/string/formatString/index.d.ts +5 -0
  217. package/module/es5/types/string/formatString/index.js +60 -0
  218. package/module/es5/types/string/index.d.ts +1 -0
  219. package/module/es5/types/string/index.js +16 -0
  220. package/module/types/index.d.ts +1 -0
  221. package/module/types/index.js +1 -0
  222. package/module/types/index.js.map +1 -1
  223. package/module/types/logic/deepPartial.d.ts +37 -0
  224. package/module/types/logic/deepPartial.js +36 -0
  225. package/module/types/logic/deepPartial.js.map +1 -0
  226. package/module/types/logic/deepRequired.d.ts +37 -0
  227. package/module/types/logic/deepRequired.js +2 -0
  228. package/module/types/logic/deepRequired.js.map +1 -0
  229. package/module/types/logic/index.d.ts +3 -0
  230. package/module/types/logic/index.js +3 -0
  231. package/module/types/logic/index.js.map +1 -1
  232. package/module/types/logic/unionToIntersection.d.ts +12 -0
  233. package/module/types/logic/unionToIntersection.js +2 -0
  234. package/module/types/logic/unionToIntersection.js.map +1 -0
  235. package/module/types/object/index.d.ts +1 -0
  236. package/module/types/object/index.js +1 -0
  237. package/module/types/object/index.js.map +1 -1
  238. package/module/types/object/pickDeep.d.ts +13 -1
  239. package/module/types/object/shallowObjectValue.d.ts +9 -0
  240. package/module/types/object/shallowObjectValue.js +2 -0
  241. package/module/types/object/shallowObjectValue.js.map +1 -0
  242. package/module/types/string/formatString/formatData.d.ts +17 -0
  243. package/module/types/string/formatString/formatData.js +2 -0
  244. package/module/types/string/formatString/formatData.js.map +1 -0
  245. package/module/types/string/formatString/formatOptions.d.ts +21 -0
  246. package/module/types/string/formatString/formatOptions.js +2 -0
  247. package/module/types/string/formatString/formatOptions.js.map +1 -0
  248. package/module/types/string/formatString/formatString.d.ts +4 -0
  249. package/module/types/string/formatString/formatString.js +5 -0
  250. package/module/types/string/formatString/formatString.js.map +1 -0
  251. package/module/types/string/formatString/formatValue.d.ts +15 -0
  252. package/module/types/string/formatString/formatValue.js +2 -0
  253. package/module/types/string/formatString/formatValue.js.map +1 -0
  254. package/module/types/string/formatString/formatter.d.ts +13 -0
  255. package/module/types/string/formatString/formatter.js +2 -0
  256. package/module/types/string/formatString/formatter.js.map +1 -0
  257. package/module/types/string/formatString/index.d.ts +5 -0
  258. package/module/types/string/formatString/index.js +6 -0
  259. package/module/types/string/formatString/index.js.map +1 -0
  260. package/module/types/string/index.d.ts +1 -0
  261. package/module/types/string/index.js +2 -0
  262. package/module/types/string/index.js.map +1 -0
  263. package/package.json +31 -32
  264. package/module/String/formatString.d.ts +0 -13
  265. package/module/String/formatString.js +0 -18
  266. package/module/String/formatString.js.map +0 -1
  267. package/module/es5/String/formatString.d.ts +0 -13
  268. package/module/es5/String/formatString.js +0 -26
@@ -0,0 +1,91 @@
1
+ import type { FormatData } from "$/string/formatString/formatData";
2
+ import type { FormatOptions } from "$/string/formatString/formatOptions";
3
+ import type { FormatValue } from "$/string/formatString/formatValue";
4
+ /**
5
+ * Replaces placeholders in a template string with specified values.
6
+ *
7
+ * Supports two modes:
8
+ * 1. **Indexed mode**: Use numbered placeholders like {0}, {1}, {2}...
9
+ * 2. **Named mode**: Use named placeholders with an object like {name}, {age}...
10
+ *
11
+ * ## Advanced Features
12
+ *
13
+ * ### Nested Object Access
14
+ * Access nested properties using dot notation: `{user.name}`, `{user.address.city}`
15
+ *
16
+ * ### Array Access
17
+ * Access array elements with brackets: `{items[0]}`, `{users[1].name}`
18
+ * Supports negative indices: `{items[-1]}` (last element), `{items[-2]}` (second to last)
19
+ *
20
+ * ### Default Values
21
+ * Provide fallback values using pipe syntax: `{name|Unknown}`, `{age|N/A}`
22
+ *
23
+ * ### Formatters
24
+ * Apply formatters to values: `{name:upper}`, `{price:currency}`, `{date:date}`
25
+ *
26
+ * Built-in formatters:
27
+ * - `upper` - Convert to uppercase
28
+ * - `lower` - Convert to lowercase
29
+ * - `currency(locale?, currency?)` - Format as currency (e.g., `{price:currency(ja-JP,JPY)}`)
30
+ * - `date(locale?, format?)` - Format dates (format: short|medium|long|full|iso|time)
31
+ * - `time(locale?)` - Format time
32
+ * - `number(locale?, minFraction?, maxFraction?)` - Format numbers
33
+ * - `plural(singular, plural)` - Pluralization (e.g., `{count:plural(item,items)}`)
34
+ * - `pad(length, char?)` - Pad string/number (e.g., `{id:pad(4,0)}`)
35
+ *
36
+ * ### Escape Sequences
37
+ * Use double braces to escape: `{{name}}` renders as literal `{name}`
38
+ *
39
+ * @param template - Template string containing placeholders
40
+ * @param data - Data object for named mode OR first value for indexed mode
41
+ * @param options - Options object with custom formatters (named mode only)
42
+ * @returns String with placeholders replaced with formatted values
43
+ *
44
+ * @example
45
+ * // Indexed mode - basic replacement
46
+ * formatString("Hello, {0}! It's {1} today.", "World", "sunny");
47
+ * // → "Hello, World! It's sunny today."
48
+ *
49
+ * @example
50
+ * // Named mode - object properties
51
+ * formatString("Hello, {name}! You are {age} years old.", { name: "Alice", age: 25 });
52
+ * // → "Hello, Alice! You are 25 years old."
53
+ *
54
+ * @example
55
+ * // Nested object access
56
+ * formatString("User: {user.name}, Email: {user.email}", {
57
+ * user: { name: "Charlie", email: "charlie@example.com" }
58
+ * });
59
+ * // → "User: Charlie, Email: charlie@example.com"
60
+ *
61
+ * @example
62
+ * // Array access with negative indices
63
+ * formatString("First: {items[0]}, Last: {items[-1]}", { items: ["A", "B", "C"] });
64
+ * // → "First: A, Last: C"
65
+ *
66
+ * @example
67
+ * // Default values
68
+ * formatString("Name: {name|Unknown}, Age: {age|N/A}", { age: 25 });
69
+ * // → "Name: Unknown, Age: 25"
70
+ *
71
+ * @example
72
+ * // Built-in formatters
73
+ * formatString("Price: {price:currency(ja-JP,JPY)}", { price: 1234 });
74
+ * // → "Price: ¥1,234"
75
+ *
76
+ * @example
77
+ * // Custom formatters
78
+ * formatString("Reversed: {text:reverse}", { text: "hello" }, {
79
+ * formatters: {
80
+ * reverse: (value) => String(value).split("").reverse().join("")
81
+ * }
82
+ * });
83
+ * // → "Reversed: olleh"
84
+ *
85
+ * @example
86
+ * // Escape sequences
87
+ * formatString("Literal {{name}} and value {name}", { name: "Alice" });
88
+ * // → "Literal {name} and value Alice"
89
+ */
90
+ export declare function formatString(template: string, data?: FormatData, options?: FormatOptions): string;
91
+ export declare function formatString(template: string, ...values: FormatValue[]): string;
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatString = formatString;
7
+ var _applyFormatter = require("./applyFormatter");
8
+ var _defaultFormatters = require("./defaultFormatters");
9
+ var _detectMode2 = require("./detectMode");
10
+ var _getValue = require("./getValue");
11
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
12
+ function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
13
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
15
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
20
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
23
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
24
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
25
+ /**
26
+ * Replaces placeholders in a template string with specified values.
27
+ *
28
+ * Supports two modes:
29
+ * 1. **Indexed mode**: Use numbered placeholders like {0}, {1}, {2}...
30
+ * 2. **Named mode**: Use named placeholders with an object like {name}, {age}...
31
+ *
32
+ * ## Advanced Features
33
+ *
34
+ * ### Nested Object Access
35
+ * Access nested properties using dot notation: `{user.name}`, `{user.address.city}`
36
+ *
37
+ * ### Array Access
38
+ * Access array elements with brackets: `{items[0]}`, `{users[1].name}`
39
+ * Supports negative indices: `{items[-1]}` (last element), `{items[-2]}` (second to last)
40
+ *
41
+ * ### Default Values
42
+ * Provide fallback values using pipe syntax: `{name|Unknown}`, `{age|N/A}`
43
+ *
44
+ * ### Formatters
45
+ * Apply formatters to values: `{name:upper}`, `{price:currency}`, `{date:date}`
46
+ *
47
+ * Built-in formatters:
48
+ * - `upper` - Convert to uppercase
49
+ * - `lower` - Convert to lowercase
50
+ * - `currency(locale?, currency?)` - Format as currency (e.g., `{price:currency(ja-JP,JPY)}`)
51
+ * - `date(locale?, format?)` - Format dates (format: short|medium|long|full|iso|time)
52
+ * - `time(locale?)` - Format time
53
+ * - `number(locale?, minFraction?, maxFraction?)` - Format numbers
54
+ * - `plural(singular, plural)` - Pluralization (e.g., `{count:plural(item,items)}`)
55
+ * - `pad(length, char?)` - Pad string/number (e.g., `{id:pad(4,0)}`)
56
+ *
57
+ * ### Escape Sequences
58
+ * Use double braces to escape: `{{name}}` renders as literal `{name}`
59
+ *
60
+ * @param template - Template string containing placeholders
61
+ * @param data - Data object for named mode OR first value for indexed mode
62
+ * @param options - Options object with custom formatters (named mode only)
63
+ * @returns String with placeholders replaced with formatted values
64
+ *
65
+ * @example
66
+ * // Indexed mode - basic replacement
67
+ * formatString("Hello, {0}! It's {1} today.", "World", "sunny");
68
+ * // → "Hello, World! It's sunny today."
69
+ *
70
+ * @example
71
+ * // Named mode - object properties
72
+ * formatString("Hello, {name}! You are {age} years old.", { name: "Alice", age: 25 });
73
+ * // → "Hello, Alice! You are 25 years old."
74
+ *
75
+ * @example
76
+ * // Nested object access
77
+ * formatString("User: {user.name}, Email: {user.email}", {
78
+ * user: { name: "Charlie", email: "charlie@example.com" }
79
+ * });
80
+ * // → "User: Charlie, Email: charlie@example.com"
81
+ *
82
+ * @example
83
+ * // Array access with negative indices
84
+ * formatString("First: {items[0]}, Last: {items[-1]}", { items: ["A", "B", "C"] });
85
+ * // → "First: A, Last: C"
86
+ *
87
+ * @example
88
+ * // Default values
89
+ * formatString("Name: {name|Unknown}, Age: {age|N/A}", { age: 25 });
90
+ * // → "Name: Unknown, Age: 25"
91
+ *
92
+ * @example
93
+ * // Built-in formatters
94
+ * formatString("Price: {price:currency(ja-JP,JPY)}", { price: 1234 });
95
+ * // → "Price: ¥1,234"
96
+ *
97
+ * @example
98
+ * // Custom formatters
99
+ * formatString("Reversed: {text:reverse}", { text: "hello" }, {
100
+ * formatters: {
101
+ * reverse: (value) => String(value).split("").reverse().join("")
102
+ * }
103
+ * });
104
+ * // → "Reversed: olleh"
105
+ *
106
+ * @example
107
+ * // Escape sequences
108
+ * formatString("Literal {{name}} and value {name}", { name: "Alice" });
109
+ * // → "Literal {name} and value Alice"
110
+ */
111
+
112
+ function formatString(template, dataOrFirstValue, optionsOrSecondValue) {
113
+ var escapedTemplate = template.replaceAll("{{", "\0").replaceAll("}}", "\x01");
114
+ for (var _len = arguments.length, restValues = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
115
+ restValues[_key - 3] = arguments[_key];
116
+ }
117
+ var _detectMode = (0, _detectMode2.detectMode)(dataOrFirstValue, optionsOrSecondValue, restValues),
118
+ data = _detectMode.data,
119
+ options = _detectMode.options;
120
+ var formatters = _objectSpread(_objectSpread({}, _defaultFormatters.defaultFormatters), options.formatters);
121
+ var result = escapedTemplate.replaceAll(/{([^}]+)}/g, function (match, content) {
122
+ var _content$split$map = content.split("|").map(function (part) {
123
+ return part.trim();
124
+ }),
125
+ _content$split$map2 = _slicedToArray(_content$split$map, 2),
126
+ pathAndFormatter = _content$split$map2[0],
127
+ defaultValue = _content$split$map2[1];
128
+ var _pathAndFormatter$spl = pathAndFormatter.split(":"),
129
+ _pathAndFormatter$spl2 = _toArray(_pathAndFormatter$spl),
130
+ path = _pathAndFormatter$spl2[0],
131
+ formatterParts = _pathAndFormatter$spl2.slice(1);
132
+ var formatterString = formatterParts.join(":");
133
+ var value;
134
+ if (Array.isArray(data)) {
135
+ var index = Number(path);
136
+ value = Number.isNaN(index) ? undefined : data[index];
137
+ } else {
138
+ value = (0, _getValue.getValue)(data, path);
139
+ }
140
+ if (value === undefined || value === null) {
141
+ if (defaultValue === undefined) {
142
+ return match;
143
+ }
144
+ value = defaultValue;
145
+ }
146
+ if (formatterString) {
147
+ return (0, _applyFormatter.applyFormatter)(value, formatterString, formatters);
148
+ }
149
+ return String(value);
150
+ });
151
+ return result.replaceAll("\0", "{").replaceAll("\x01", "}");
152
+ }
@@ -1,12 +1,17 @@
1
+ export * from "./camelCase";
1
2
  export * from "./deleteSpaces";
3
+ export * from "./escapeHtml";
2
4
  export * from "./formatString";
3
5
  export * from "./fromBase64";
4
6
  export * from "./hasNoLetters";
7
+ export * from "./kebabCase";
8
+ export * from "./levenshteinDistance";
5
9
  export * from "./padEnd";
6
10
  export * from "./padStart";
7
11
  export * from "./randomString";
8
12
  export * from "./randomStringInitialization";
9
13
  export * from "./reverseString";
14
+ export * from "./stringSimilarity";
10
15
  export * from "./toBase64";
11
16
  export * from "./toHalfWidth";
12
17
  export * from "./trimCharacters";
@@ -3,6 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _camelCase = require("./camelCase");
7
+ Object.keys(_camelCase).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _camelCase[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _camelCase[key];
14
+ }
15
+ });
16
+ });
6
17
  var _deleteSpaces = require("./deleteSpaces");
7
18
  Object.keys(_deleteSpaces).forEach(function (key) {
8
19
  if (key === "default" || key === "__esModule") return;
@@ -14,6 +25,17 @@ Object.keys(_deleteSpaces).forEach(function (key) {
14
25
  }
15
26
  });
16
27
  });
28
+ var _escapeHtml = require("./escapeHtml");
29
+ Object.keys(_escapeHtml).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _escapeHtml[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _escapeHtml[key];
36
+ }
37
+ });
38
+ });
17
39
  var _formatString = require("./formatString");
18
40
  Object.keys(_formatString).forEach(function (key) {
19
41
  if (key === "default" || key === "__esModule") return;
@@ -47,6 +69,28 @@ Object.keys(_hasNoLetters).forEach(function (key) {
47
69
  }
48
70
  });
49
71
  });
72
+ var _kebabCase = require("./kebabCase");
73
+ Object.keys(_kebabCase).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _kebabCase[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function get() {
79
+ return _kebabCase[key];
80
+ }
81
+ });
82
+ });
83
+ var _levenshteinDistance = require("./levenshteinDistance");
84
+ Object.keys(_levenshteinDistance).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _levenshteinDistance[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function get() {
90
+ return _levenshteinDistance[key];
91
+ }
92
+ });
93
+ });
50
94
  var _padEnd = require("./padEnd");
51
95
  Object.keys(_padEnd).forEach(function (key) {
52
96
  if (key === "default" || key === "__esModule") return;
@@ -102,6 +146,17 @@ Object.keys(_reverseString).forEach(function (key) {
102
146
  }
103
147
  });
104
148
  });
149
+ var _stringSimilarity = require("./stringSimilarity");
150
+ Object.keys(_stringSimilarity).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _stringSimilarity[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function get() {
156
+ return _stringSimilarity[key];
157
+ }
158
+ });
159
+ });
105
160
  var _toBase = require("./toBase64");
106
161
  Object.keys(_toBase).forEach(function (key) {
107
162
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Converts a string to kebab-case
3
+ * @param str - The string to convert
4
+ * @returns The kebab-case string
5
+ */
6
+ export declare const kebabCase: (string_: string) => string;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.kebabCase = void 0;
7
+ /**
8
+ * Converts a string to kebab-case
9
+ * @param str - The string to convert
10
+ * @returns The kebab-case string
11
+ */
12
+ var kebabCase = exports.kebabCase = function kebabCase(string_) {
13
+ return string_
14
+ // Insert dash between lowercase and uppercase
15
+ .replaceAll(/([a-z])([A-Z])/g, "$1-$2")
16
+ // Insert dash between sequences of uppercase letters and following lowercase
17
+ .replaceAll(/([A-Z])([A-Z][a-z])/g, "$1-$2")
18
+ // Replace spaces and underscores with dashes
19
+ .replaceAll(/[\s_]+/g, "-")
20
+ // Remove special characters except alphanumeric and dashes
21
+ .replaceAll(/[^a-zA-Z0-9-]/g, "-")
22
+ // Remove multiple consecutive dashes
23
+ .replaceAll(/-+/g, "-")
24
+ // Remove leading and trailing dashes
25
+ .replaceAll(/^-|-$/g, "").toLowerCase();
26
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Calculates the Levenshtein distance between two strings
3
+ * Returns the minimum number of single-character edits (insertions, deletions, or substitutions)
4
+ * @param str1 - First string to compare
5
+ * @param str2 - Second string to compare
6
+ * @returns The Levenshtein distance
7
+ */
8
+ export declare const levenshteinDistance: (string1: string, string2: string) => number;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.levenshteinDistance = void 0;
7
+ /**
8
+ * Calculates the Levenshtein distance between two strings
9
+ * Returns the minimum number of single-character edits (insertions, deletions, or substitutions)
10
+ * @param str1 - First string to compare
11
+ * @param str2 - Second string to compare
12
+ * @returns The Levenshtein distance
13
+ */
14
+ var levenshteinDistance = exports.levenshteinDistance = function levenshteinDistance(string1, string2) {
15
+ var length1 = string1.length;
16
+ var length2 = string2.length;
17
+
18
+ // Return the length of the other string if one is empty
19
+ if (length1 === 0) {
20
+ return length2;
21
+ }
22
+ if (length2 === 0) {
23
+ return length1;
24
+ }
25
+
26
+ // Create a 2D array for dynamic programming
27
+ var matrix = Array.from({
28
+ length: length1 + 1
29
+ }, function () {
30
+ return Array.from({
31
+ length: length2 + 1
32
+ }, function () {
33
+ return 0;
34
+ });
35
+ });
36
+
37
+ // Initialize first column and row
38
+ for (var index = 0; index <= length1; index++) {
39
+ matrix[index][0] = index;
40
+ }
41
+ for (var _index = 0; _index <= length2; _index++) {
42
+ matrix[0][_index] = _index;
43
+ }
44
+
45
+ // Calculate distances
46
+ for (var _index2 = 1; _index2 <= length1; _index2++) {
47
+ for (var index_ = 1; index_ <= length2; index_++) {
48
+ var cost = string1[_index2 - 1] === string2[index_ - 1] ? 0 : 1;
49
+ matrix[_index2][index_] = Math.min(matrix[_index2 - 1][index_] + 1,
50
+ // deletion
51
+ matrix[_index2][index_ - 1] + 1,
52
+ // insertion
53
+ matrix[_index2 - 1][index_ - 1] + cost // substitution
54
+ );
55
+ }
56
+ }
57
+ return matrix[length1][length2];
58
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Calculates the similarity between two strings as a percentage
3
+ * Uses Levenshtein distance normalized by the length of the longer string
4
+ * @param str1 - First string to compare
5
+ * @param str2 - Second string to compare
6
+ * @returns Similarity score between 0 (completely different) and 1 (identical)
7
+ */
8
+ export declare const stringSimilarity: (string1: string, string2: string) => number;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.stringSimilarity = void 0;
7
+ var _levenshteinDistance = require("./levenshteinDistance");
8
+ /**
9
+ * Calculates the similarity between two strings as a percentage
10
+ * Uses Levenshtein distance normalized by the length of the longer string
11
+ * @param str1 - First string to compare
12
+ * @param str2 - Second string to compare
13
+ * @returns Similarity score between 0 (completely different) and 1 (identical)
14
+ */
15
+ var stringSimilarity = exports.stringSimilarity = function stringSimilarity(string1, string2) {
16
+ // Identical strings have 100% similarity
17
+ if (string1 === string2) {
18
+ return 1;
19
+ }
20
+
21
+ // Empty strings handling
22
+ if (string1.length === 0 || string2.length === 0) {
23
+ return 0;
24
+ }
25
+ var distance = (0, _levenshteinDistance.levenshteinDistance)(string1, string2);
26
+ var maxLength = Math.max(string1.length, string2.length);
27
+
28
+ // Calculate similarity as 1 - (distance / maxLength)
29
+ return 1 - distance / maxLength;
30
+ };
@@ -24,7 +24,6 @@ var core = exports.core = function core(type) {
24
24
  return function (value) {
25
25
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
26
26
  var message = arguments.length > 2 ? arguments[2] : undefined;
27
- // biome-ignore lint/suspicious/useValidTypeof: Type parameter is a string literal type from Types<T>
28
27
  if (_typeof(value) !== type) {
29
28
  return {
30
29
  validate: false,
@@ -18,7 +18,7 @@ var isDouble = exports.isDouble = function isDouble(x) {
18
18
  var loose = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
19
19
  if (loose) {
20
20
  return (
21
- // biome-ignore lint/suspicious/noGlobalIsFinite: <explanation>
21
+ // biome-ignore lint/suspicious/noGlobalIsFinite: ignore
22
22
  isFinite(x) && !Number.isNaN(x) && Number.isFinite(Number(x)) && !Number.isInteger(Number(x))
23
23
  );
24
24
  }
@@ -9,6 +9,7 @@ exports.isNode = void 0;
9
9
  */
10
10
  var isNode = exports.isNode = function isNode() {
11
11
  try {
12
+ // biome-ignore lint/nursery/noProcessGlobal: ignore
12
13
  return typeof process !== "undefined" && typeof require !== "undefined";
13
14
  } catch (_unused) {
14
15
  return false;
@@ -23,6 +23,6 @@ var isNumber = exports.isNumber = function isNumber(number) {
23
23
  return false;
24
24
  }
25
25
  return number !== null && typeof number !== "boolean" && loose ?
26
- // biome-ignore lint/suspicious/noGlobalIsFinite: <explanation>
26
+ // biome-ignore lint/suspicious/noGlobalIsFinite: ignore
27
27
  isFinite(number) : Number.isFinite(number);
28
28
  };
@@ -17,6 +17,6 @@ exports.isValueNaN = void 0;
17
17
  */
18
18
  var isValueNaN = exports.isValueNaN = function isValueNaN(value) {
19
19
  var loose = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
20
- // biome-ignore lint/suspicious/noGlobalIsNan: <explanation>
20
+ // biome-ignore lint/suspicious/noGlobalIsNan: ignore
21
21
  return loose ? isNaN(value) : Number.isNaN(value);
22
22
  };
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.even = void 0;
7
+ var _isDouble = require("@/Validate/isDouble");
7
8
  /**
8
9
  * Number validation module for even numbers
9
10
  * Provides validation functionality for checking if a number is even
@@ -19,6 +20,9 @@ var even = exports.even = function even(message) {
19
20
  type: "number",
20
21
  message: message,
21
22
  validate: function validate(value) {
23
+ if ((0, _isDouble.isDouble)(value, false)) {
24
+ return false;
25
+ }
22
26
  return value % 2 === 0;
23
27
  }
24
28
  };
@@ -4,11 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.odd = void 0;
7
+ var _isDouble = require("@/Validate/isDouble");
7
8
  var odd = exports.odd = function odd(message) {
8
9
  return {
9
10
  type: "number",
10
11
  message: message,
11
12
  validate: function validate(value) {
13
+ if ((0, _isDouble.isDouble)(value, false)) {
14
+ return false;
15
+ }
12
16
  return value % 2 !== 0;
13
17
  }
14
18
  };
@@ -4,6 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.email = void 0;
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
13
  /**
8
14
  * String validation module for email addresses
9
15
  * Provides validation functionality for checking if a string is a valid email address
@@ -16,11 +22,30 @@ exports.email = void 0;
16
22
  */
17
23
  var email = exports.email = function email(message) {
18
24
  // Regular expression for email address validation
19
- var emailRegex = /^[\+\x2D0-9A-Z_a-z\u017F\u212A]+(?:\.[\+\x2D0-9A-Z_a-z\u017F\u212A]+)*@[0-9a-z\u017F\u212A]+(?:[\x2D\.][0-9a-z\u017F\u212A]+)*\.[a-z\u017F\u212A]{2,}$/i;
25
+ var emailRegex = /^[a-zA-Z0-9]([a-zA-Z0-9._+-]*[a-zA-Z0-9])?@[a-zA-Z0-9]([a-zA-Z0-9.-]*[a-zA-Z0-9])?\.[a-zA-Z]{2,}$/;
20
26
  return {
21
27
  type: "string",
22
28
  message: message,
23
29
  validate: function validate(value) {
30
+ // Check for consecutive dots
31
+ if (value.includes("..")) {
32
+ return false;
33
+ }
34
+ // Check for leading/trailing dots in local part
35
+ var _value$split = value.split("@"),
36
+ _value$split2 = _slicedToArray(_value$split, 2),
37
+ localPart = _value$split2[0],
38
+ domainPart = _value$split2[1];
39
+ if (!(localPart && domainPart)) {
40
+ return false;
41
+ }
42
+ if (localPart.startsWith(".") || localPart.endsWith(".")) {
43
+ return false;
44
+ }
45
+ if (domainPart.startsWith(".") || domainPart.endsWith(".")) {
46
+ return false;
47
+ }
48
+ // Use regex for final validation
24
49
  return emailRegex.test(value);
25
50
  }
26
51
  };