@develia/commons 0.4.14 → 0.4.15

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 (220) hide show
  1. package/dist/cjs/array.js +27 -1
  2. package/dist/cjs/array.js.map +1 -1
  3. package/dist/cjs/async-pool-executor.js +15 -0
  4. package/dist/cjs/async-pool-executor.js.map +1 -1
  5. package/dist/cjs/browser/form-utilities.js +26 -0
  6. package/dist/cjs/browser/form-utilities.js.map +1 -1
  7. package/dist/cjs/browser/geo-location.js +5 -0
  8. package/dist/cjs/browser/geo-location.js.map +1 -1
  9. package/dist/cjs/browser/index.js.map +1 -1
  10. package/dist/cjs/browser/native-bridge.js +9 -0
  11. package/dist/cjs/browser/native-bridge.js.map +1 -1
  12. package/dist/cjs/cancellable-promise.js.map +1 -1
  13. package/dist/cjs/clean-url-search-params.js +1 -0
  14. package/dist/cjs/clean-url-search-params.js.map +1 -1
  15. package/dist/cjs/collections/cache-dictionary.js +39 -0
  16. package/dist/cjs/collections/cache-dictionary.js.map +1 -1
  17. package/dist/cjs/collections/default-map.js +25 -1
  18. package/dist/cjs/collections/default-map.js.map +1 -1
  19. package/dist/cjs/collections/default-weak-map.js +23 -3
  20. package/dist/cjs/collections/default-weak-map.js.map +1 -1
  21. package/dist/cjs/{from.js → collections/from.js} +278 -4
  22. package/dist/cjs/collections/from.js.map +1 -0
  23. package/dist/cjs/collections/index.js +3 -1
  24. package/dist/cjs/collections/index.js.map +1 -1
  25. package/dist/cjs/draft.js +37 -0
  26. package/dist/cjs/draft.js.map +1 -1
  27. package/dist/cjs/event-bus.js +1 -0
  28. package/dist/cjs/event-bus.js.map +1 -1
  29. package/dist/cjs/index.js +14 -3
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/key-value-pair.js +6 -0
  32. package/dist/cjs/key-value-pair.js.map +1 -1
  33. package/dist/cjs/lazy.js +4 -0
  34. package/dist/cjs/lazy.js.map +1 -1
  35. package/dist/cjs/math.js +19 -0
  36. package/dist/cjs/math.js.map +1 -1
  37. package/dist/cjs/order.js.map +1 -1
  38. package/dist/cjs/parse.js +96 -0
  39. package/dist/cjs/parse.js.map +1 -1
  40. package/dist/cjs/patch.js +10 -2
  41. package/dist/cjs/patch.js.map +1 -1
  42. package/dist/cjs/stopwatch.js +10 -0
  43. package/dist/cjs/stopwatch.js.map +1 -1
  44. package/dist/cjs/string.js +62 -0
  45. package/dist/cjs/string.js.map +1 -1
  46. package/dist/cjs/timer.js +7 -0
  47. package/dist/cjs/timer.js.map +1 -1
  48. package/dist/cjs/timespan.js +202 -0
  49. package/dist/cjs/timespan.js.map +1 -1
  50. package/dist/cjs/type-code.js.map +1 -1
  51. package/dist/cjs/type.js +80 -1
  52. package/dist/cjs/type.js.map +1 -1
  53. package/dist/cjs/types.js.map +1 -1
  54. package/dist/cjs/utilities.js +183 -0
  55. package/dist/cjs/utilities.js.map +1 -1
  56. package/dist/esm/array.js +27 -1
  57. package/dist/esm/array.js.map +1 -1
  58. package/dist/esm/async-pool-executor.js +15 -0
  59. package/dist/esm/async-pool-executor.js.map +1 -1
  60. package/dist/esm/browser/form-utilities.js +26 -0
  61. package/dist/esm/browser/form-utilities.js.map +1 -1
  62. package/dist/esm/browser/geo-location.js +5 -0
  63. package/dist/esm/browser/geo-location.js.map +1 -1
  64. package/dist/esm/browser/index.js.map +1 -1
  65. package/dist/esm/browser/native-bridge.js +9 -0
  66. package/dist/esm/browser/native-bridge.js.map +1 -1
  67. package/dist/esm/cancellable-promise.js.map +1 -1
  68. package/dist/esm/clean-url-search-params.js +1 -0
  69. package/dist/esm/clean-url-search-params.js.map +1 -1
  70. package/dist/esm/collections/cache-dictionary.js +39 -0
  71. package/dist/esm/collections/cache-dictionary.js.map +1 -1
  72. package/dist/esm/collections/default-map.js +25 -1
  73. package/dist/esm/collections/default-map.js.map +1 -1
  74. package/dist/esm/collections/default-weak-map.js +22 -2
  75. package/dist/esm/collections/default-weak-map.js.map +1 -1
  76. package/dist/esm/{from.js → collections/from.js} +278 -4
  77. package/dist/esm/collections/from.js.map +1 -0
  78. package/dist/esm/collections/index.js +1 -0
  79. package/dist/esm/collections/index.js.map +1 -1
  80. package/dist/esm/draft.js +37 -0
  81. package/dist/esm/draft.js.map +1 -1
  82. package/dist/esm/event-bus.js +1 -0
  83. package/dist/esm/event-bus.js.map +1 -1
  84. package/dist/esm/index.js +13 -1
  85. package/dist/esm/index.js.map +1 -1
  86. package/dist/esm/key-value-pair.js +6 -0
  87. package/dist/esm/key-value-pair.js.map +1 -1
  88. package/dist/esm/lazy.js +4 -0
  89. package/dist/esm/lazy.js.map +1 -1
  90. package/dist/esm/math.js +19 -0
  91. package/dist/esm/math.js.map +1 -1
  92. package/dist/esm/order.js.map +1 -1
  93. package/dist/esm/parse.js +96 -0
  94. package/dist/esm/parse.js.map +1 -1
  95. package/dist/esm/patch.js +10 -2
  96. package/dist/esm/patch.js.map +1 -1
  97. package/dist/esm/stopwatch.js +10 -0
  98. package/dist/esm/stopwatch.js.map +1 -1
  99. package/dist/esm/string.js +62 -0
  100. package/dist/esm/string.js.map +1 -1
  101. package/dist/esm/timer.js +7 -0
  102. package/dist/esm/timer.js.map +1 -1
  103. package/dist/esm/timespan.js +202 -0
  104. package/dist/esm/timespan.js.map +1 -1
  105. package/dist/esm/type-code.js.map +1 -1
  106. package/dist/esm/type.js +80 -1
  107. package/dist/esm/type.js.map +1 -1
  108. package/dist/esm/types.js.map +1 -1
  109. package/dist/esm/utilities.js +183 -0
  110. package/dist/esm/utilities.js.map +1 -1
  111. package/dist/types/array.d.ts +26 -0
  112. package/dist/types/array.d.ts.map +1 -1
  113. package/dist/types/async-pool-executor.d.ts +15 -0
  114. package/dist/types/async-pool-executor.d.ts.map +1 -1
  115. package/dist/types/browser/form-utilities.d.ts +13 -0
  116. package/dist/types/browser/form-utilities.d.ts.map +1 -1
  117. package/dist/types/browser/index.d.ts.map +1 -1
  118. package/dist/types/browser/native-bridge.d.ts +6 -0
  119. package/dist/types/browser/native-bridge.d.ts.map +1 -1
  120. package/dist/types/collections/cache-dictionary.d.ts +39 -0
  121. package/dist/types/collections/cache-dictionary.d.ts.map +1 -1
  122. package/dist/types/collections/default-map.d.ts +23 -0
  123. package/dist/types/collections/default-map.d.ts.map +1 -1
  124. package/dist/types/collections/default-weak-map.d.ts +20 -1
  125. package/dist/types/collections/default-weak-map.d.ts.map +1 -1
  126. package/dist/types/collections/from.d.ts +333 -0
  127. package/dist/types/collections/from.d.ts.map +1 -0
  128. package/dist/types/collections/index.d.ts +1 -0
  129. package/dist/types/collections/index.d.ts.map +1 -1
  130. package/dist/types/draft.d.ts +68 -0
  131. package/dist/types/draft.d.ts.map +1 -1
  132. package/dist/types/index.d.ts +4 -1
  133. package/dist/types/index.d.ts.map +1 -1
  134. package/dist/types/key-value-pair.d.ts +6 -0
  135. package/dist/types/key-value-pair.d.ts.map +1 -1
  136. package/dist/types/lazy.d.ts +4 -0
  137. package/dist/types/lazy.d.ts.map +1 -1
  138. package/dist/types/math.d.ts +19 -0
  139. package/dist/types/math.d.ts.map +1 -1
  140. package/dist/types/parse.d.ts +121 -0
  141. package/dist/types/parse.d.ts.map +1 -1
  142. package/dist/types/string.d.ts +51 -0
  143. package/dist/types/string.d.ts.map +1 -1
  144. package/dist/types/timer.d.ts +7 -0
  145. package/dist/types/timer.d.ts.map +1 -1
  146. package/dist/types/timespan.d.ts +202 -0
  147. package/dist/types/timespan.d.ts.map +1 -1
  148. package/dist/types/type.d.ts +40 -0
  149. package/dist/types/type.d.ts.map +1 -1
  150. package/dist/types/utilities.d.ts +171 -0
  151. package/dist/types/utilities.d.ts.map +1 -1
  152. package/dist/web/array.js +27 -1
  153. package/dist/web/array.js.map +1 -1
  154. package/dist/web/async-pool-executor.js +15 -0
  155. package/dist/web/async-pool-executor.js.map +1 -1
  156. package/dist/web/browser/form-utilities.js +26 -0
  157. package/dist/web/browser/form-utilities.js.map +1 -1
  158. package/dist/web/browser/geo-location.js +5 -0
  159. package/dist/web/browser/geo-location.js.map +1 -1
  160. package/dist/web/browser/index.js.map +1 -1
  161. package/dist/web/browser/native-bridge.js +9 -0
  162. package/dist/web/browser/native-bridge.js.map +1 -1
  163. package/dist/web/cancellable-promise.js.map +1 -1
  164. package/dist/web/clean-url-search-params.js +1 -0
  165. package/dist/web/clean-url-search-params.js.map +1 -1
  166. package/dist/web/collections/cache-dictionary.js +39 -0
  167. package/dist/web/collections/cache-dictionary.js.map +1 -1
  168. package/dist/web/collections/default-map.js +25 -1
  169. package/dist/web/collections/default-map.js.map +1 -1
  170. package/dist/web/collections/default-weak-map.js +22 -2
  171. package/dist/web/collections/default-weak-map.js.map +1 -1
  172. package/dist/web/{from.js → collections/from.js} +279 -5
  173. package/dist/web/collections/from.js.map +1 -0
  174. package/dist/web/collections/index.js +1 -0
  175. package/dist/web/collections/index.js.map +1 -1
  176. package/dist/web/draft.js +37 -0
  177. package/dist/web/draft.js.map +1 -1
  178. package/dist/web/event-bus.js +1 -0
  179. package/dist/web/event-bus.js.map +1 -1
  180. package/dist/web/index.js +13 -1
  181. package/dist/web/index.js.map +1 -1
  182. package/dist/web/key-value-pair.js +6 -0
  183. package/dist/web/key-value-pair.js.map +1 -1
  184. package/dist/web/lazy.js +4 -0
  185. package/dist/web/lazy.js.map +1 -1
  186. package/dist/web/math.js +19 -0
  187. package/dist/web/math.js.map +1 -1
  188. package/dist/web/order.js.map +1 -1
  189. package/dist/web/parse.js +96 -0
  190. package/dist/web/parse.js.map +1 -1
  191. package/dist/web/patch.js +10 -2
  192. package/dist/web/patch.js.map +1 -1
  193. package/dist/web/stopwatch.js +10 -0
  194. package/dist/web/stopwatch.js.map +1 -1
  195. package/dist/web/string.js +62 -0
  196. package/dist/web/string.js.map +1 -1
  197. package/dist/web/timer.js +7 -0
  198. package/dist/web/timer.js.map +1 -1
  199. package/dist/web/timespan.js +202 -0
  200. package/dist/web/timespan.js.map +1 -1
  201. package/dist/web/type-code.js.map +1 -1
  202. package/dist/web/type.js +80 -1
  203. package/dist/web/type.js.map +1 -1
  204. package/dist/web/types.js.map +1 -1
  205. package/dist/web/utilities.js +183 -0
  206. package/dist/web/utilities.js.map +1 -1
  207. package/package.json +1 -1
  208. package/src/browser/index.ts +2 -2
  209. package/src/collections/cache-dictionary.ts +39 -1
  210. package/src/collections/default-map.ts +15 -9
  211. package/src/collections/default-weak-map.ts +14 -12
  212. package/src/{from.ts → collections/from.ts} +285 -15
  213. package/src/collections/index.ts +4 -3
  214. package/src/index.ts +1 -1
  215. package/src/timespan.ts +199 -20
  216. package/dist/cjs/from.js.map +0 -1
  217. package/dist/esm/from.js.map +0 -1
  218. package/dist/types/from.d.ts +0 -59
  219. package/dist/types/from.d.ts.map +0 -1
  220. package/dist/web/from.js.map +0 -1
@@ -1,17 +1,85 @@
1
+ /**
2
+ * Methods injected into a draft proxy in addition to the original object's properties.
3
+ *
4
+ * @template T - The shape of the wrapped object.
5
+ */
1
6
  type DraftMethods<T> = {
7
+ /**
8
+ * Apply pending changes to the original object.
9
+ *
10
+ * @param key - Optional property key. If provided, commits only that property.
11
+ * If omitted, commits every modified property recursively.
12
+ * @returns `true` when a single-property commit was applied,
13
+ * `false` when the property was not modified,
14
+ * `void` when committing the whole draft.
15
+ */
2
16
  commit(key?: keyof T): boolean | void;
17
+ /**
18
+ * Discard pending changes, restoring values from the original object.
19
+ *
20
+ * @param key - Optional property key. If provided, rolls back only that property.
21
+ * If omitted, rolls back every modified property recursively.
22
+ * @returns `true` when a single-property rollback was applied,
23
+ * `false` when the property was not modified,
24
+ * `void` when rolling back the whole draft.
25
+ */
3
26
  rollback(key?: keyof T): boolean | void;
27
+ /**
28
+ * Check whether the draft (or a specific property) has pending changes.
29
+ *
30
+ * @param key - Optional property key. If omitted, checks the whole draft.
31
+ * @returns `true` if there are pending changes.
32
+ */
4
33
  isModified(key?: keyof T): boolean;
34
+ /**
35
+ * Get the list of property keys with pending changes at this draft level.
36
+ *
37
+ * @returns Array of modified property keys (does not recurse into children).
38
+ */
5
39
  modifiedProps(): (keyof T)[];
40
+ /**
41
+ * Manually mark (or unmark) a property as modified.
42
+ * Primarily used by child drafts to notify their parent, but also
43
+ * available for advanced manual control.
44
+ *
45
+ * @param key - Property key to flag.
46
+ * @param modified - `true` to mark as modified (default), `false` to clear.
47
+ */
6
48
  setModified(key: keyof T, modified?: boolean): void;
7
49
  };
50
+ /**
51
+ * A draft proxy: the original object's properties plus draft control methods.
52
+ *
53
+ * @template T - The shape of the wrapped object.
54
+ */
8
55
  export type Draft<T extends object> = T & DraftMethods<T>;
56
+ /**
57
+ * Link from a child draft to its parent, used to propagate modification status.
58
+ */
9
59
  type ParentLink = {
60
+ /** Parent draft methods reference (we only need `setModified`). */
10
61
  parent: {
11
62
  setModified(key: PropertyKey, modified?: boolean): void;
12
63
  };
64
+ /** Key under which this draft is stored in the parent. */
13
65
  keyInParent: PropertyKey;
14
66
  };
67
+ /**
68
+ * Create a draft proxy over `original`. The proxy exposes the same properties
69
+ * as the original (with nested objects wrapped as child drafts) plus the
70
+ * control methods `commit`, `rollback`, `isModified`, `modifiedProps` and
71
+ * `setModified`.
72
+ *
73
+ * Mutations on the draft do not affect the original until `commit()` is called.
74
+ * Nested mutations bubble up: modifying a deep property marks every ancestor
75
+ * draft as modified at the corresponding key.
76
+ *
77
+ * @template T - The shape of the wrapped object.
78
+ * @param original - The object to wrap. It will only be mutated on `commit()`.
79
+ * @param parentLink - Internal link used when this draft is a child of another.
80
+ * Do not pass manually.
81
+ * @returns A draft proxy over a deep copy of `original`.
82
+ */
15
83
  export default function draft<T extends object>(original: T, parentLink?: ParentLink): Draft<T>;
16
84
  export {};
17
85
  //# sourceMappingURL=draft.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/draft.ts"],"names":[],"mappings":"AAKA,KAAK,YAAY,CAAC,CAAC,IAAI;IAUnB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAWtC,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WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACvD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAE1D;;GAEG;AACH,KAAK,UAAU,GAAG;IACd,mEAAmE;IACnE,MAAM,EAAE;QAAE,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IACpE,0DAA0D;IAC1D,WAAW,EAAE,WAAW,CAAC;CAC5B,CAAC;AAsCF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,CAAC,SAAS,MAAM,EAC1C,QAAQ,EAAE,CAAC,EACX,UAAU,CAAC,EAAE,UAAU,GACxB,KAAK,CAAC,CAAC,CAAC,CA6IV"}
@@ -12,11 +12,14 @@ export { default as TimeSpan } from './timespan.js';
12
12
  export { default as Stopwatch } from './stopwatch.js';
13
13
  export { default as AsyncPoolExecutor } from './async-pool-executor.js';
14
14
  export { default as Lazy } from './lazy.js';
15
- export { default as from, From } from './from.js';
15
+ export { default as from } from './collections/from.js';
16
16
  export { EventBus, Event } from './event-bus.js';
17
17
  export { default as draft } from './draft.js';
18
18
  export { default as CleanURLSearchParams } from './clean-url-search-params.js';
19
+ /** @deprecated */
19
20
  export { ajaxSubmit, ajaxSubmission, submitForm, formToObject } from './browser/index.js';
21
+ /** @deprecated */
20
22
  export * from './array.js';
23
+ /** @deprecated */
21
24
  export * from './collections/index.js';
22
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,WAAW,CA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AO,IAAI,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGnD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAGtE,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAC,OAAO,IAAI,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AAC7E,mBAAmB;AACnB,OAAO,EAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAKxF,mBAAmB;AACnB,cAAc,YAAY,CAAC;AAC3B,mBAAmB;AACnB,cAAc,wBAAwB,CAAC"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Represents a pair of key and value.
3
+ *
4
+ * @template TKey The type of the key.
5
+ * @template TValue The type of the value.
6
+ */
1
7
  export default class KeyValuePair<TKey, TValue> {
2
8
  get value(): TValue;
3
9
  get key(): TKey;
@@ -1 +1 @@
1
- {"version":3,"file":"key-value-pair.d.ts","sourceRoot":"","sources":["../../src/key-value-pair.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM;IAC1C,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,GAAG,IAAI,IAAI,CAEd;IAED,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM;CAMvC"}
1
+ {"version":3,"file":"key-value-pair.d.ts","sourceRoot":"","sources":["../../src/key-value-pair.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM;IAC1C,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,GAAG,IAAI,IAAI,CAEd;IAED,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM;CAMvC"}
@@ -1,4 +1,8 @@
1
1
  import type { Supplier } from "./types.js";
2
+ /**
3
+ * Represents a lazy value that is created only when it is accessed for the first time.
4
+ * @template T The type of the lazy value.
5
+ */
2
6
  export default class Lazy<T> {
3
7
  private _valueCreated;
4
8
  private _value;
@@ -1 +1 @@
1
- {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,QAAQ,EAAC,MAAM,YAAY,CAAC;AAOnD,MAAM,CAAC,OAAO,OAAO,IAAI,CAAC,CAAC;IACvB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAc;gBAEjC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAI/B,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAW,KAAK,IAAI,CAAC,CAMpB;IAED,KAAK,IAAI,IAAI;CAIhB"}
1
+ {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,QAAQ,EAAC,MAAM,YAAY,CAAC;AAGnD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,IAAI,CAAC,CAAC;IACvB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAc;gBAEjC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAI/B,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAW,KAAK,IAAI,CAAC,CAMpB;IAED,KAAK,IAAI,IAAI;CAIhB"}
@@ -1,3 +1,22 @@
1
+ /**
2
+ * Linearly interpolates a number between two ranges.
3
+ *
4
+ * @param {number} n - The number to interpolate.
5
+ * @param {number} inMin - The minimum value of the input range.
6
+ * @param {number} inMax - The maximum value of the input range.
7
+ * @param {number} outMin - The minimum value of the output range.
8
+ * @param {number} outMax - The maximum value of the output range.
9
+ *
10
+ * @return {number} - The interpolated value.
11
+ */
1
12
  export declare function lerp(n: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
13
+ /**
14
+ * Clamps a number between a minimum and maximum value.
15
+ *
16
+ * @param {number} n - The value to be clamped.
17
+ * @param {number} min - The minimum value.
18
+ * @param {number} max - The maximum value.
19
+ * @return {number} The clamped value.
20
+ */
2
21
  export declare function clamp(n: number, min: number, max: number): number;
3
22
  //# sourceMappingURL=math.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/math.ts"],"names":[],"mappings":"AAWA,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpG;AAUD,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMjE"}
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpG;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMjE"}
@@ -1,16 +1,137 @@
1
+ /**
2
+ * Options for {@link parseBoolean}.
3
+ */
1
4
  export interface ParseBooleanOptions {
5
+ /**
6
+ * Additional strings to consider as `true`.
7
+ * These are matched case-insensitively.
8
+ * @example ["oui", "ja"]
9
+ */
2
10
  extraTruthy?: string[];
11
+ /**
12
+ * Additional strings to consider as `false`.
13
+ * These are matched case-insensitively.
14
+ * @example ["non", "nein"]
15
+ */
3
16
  extraFalsy?: string[];
4
17
  }
18
+ /**
19
+ * Options for {@link parseInteger}.
20
+ */
5
21
  export interface ParseIntegerOptions {
22
+ /**
23
+ * Numeric base for conversion.
24
+ * @default 10
25
+ */
6
26
  radix?: number;
27
+ /**
28
+ * Thousands separator to strip before parsing.
29
+ * @example "." for "1.234.567" → 1234567
30
+ * @example "," for "1,234,567" → 1234567
31
+ */
7
32
  thousandsSeparator?: string;
8
33
  }
34
+ /**
35
+ * Options for {@link parseDecimal}.
36
+ */
9
37
  export interface ParseDecimalOptions {
38
+ /**
39
+ * Character used as decimal point.
40
+ * @default "."
41
+ */
10
42
  decimalSeparator?: "." | ",";
43
+ /**
44
+ * Thousands separator to strip before parsing.
45
+ * @example "." for "1.234,56" (EU format)
46
+ * @example "," for "1,234.56" (US format)
47
+ */
11
48
  thousandsSeparator?: string;
12
49
  }
50
+ /**
51
+ * Safely parses a value into an integer.
52
+ * Returns `null` if the value cannot be parsed.
53
+ *
54
+ * - `null` or `undefined` → `null`
55
+ * - `number` → returned as-is (floats are truncated)
56
+ * - `string` → parsed with the given options
57
+ *
58
+ * @param value - The value to parse.
59
+ * @param options - Optional parsing configuration.
60
+ * @returns The parsed integer, or `null` on failure.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * parseInteger(42) // 42
65
+ * parseInteger(3.7) // 3
66
+ * parseInteger(null) // null
67
+ * parseInteger(undefined) // null
68
+ * parseInteger("42") // 42
69
+ * parseInteger("1.234.567", { thousandsSeparator: "." }) // 1234567
70
+ * parseInteger("FF", { radix: 16 }) // 255
71
+ * parseInteger("abc") // null
72
+ * ```
73
+ */
13
74
  export declare function parseInteger(value: string | number | null | undefined, options?: ParseIntegerOptions): number | null;
75
+ /**
76
+ * Safely parses a value into a floating-point number.
77
+ * Returns `null` if the value cannot be parsed.
78
+ *
79
+ * - `null` or `undefined` → `null`
80
+ * - `number` → returned as-is (if finite)
81
+ * - `string` → parsed with the given options
82
+ *
83
+ * Supports custom decimal and thousands separators, making it suitable
84
+ * for both US (`1,234.56`) and EU (`1.234,56`) number formats.
85
+ *
86
+ * @param value - The value to parse.
87
+ * @param options - Optional parsing configuration.
88
+ * @returns The parsed float, or `null` on failure.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * parseDecimal(3.14) // 3.14
93
+ * parseDecimal(null) // null
94
+ * parseDecimal(undefined) // null
95
+ * parseDecimal("3.14") // 3.14
96
+ * parseDecimal("3,14", { decimalSeparator: "," }) // 3.14
97
+ * parseDecimal("1.234,56", { decimalSeparator: ",", thousandsSeparator: "." }) // 1234.56
98
+ * parseDecimal("abc") // null
99
+ * ```
100
+ */
14
101
  export declare function parseDecimal(value: string | number | null | undefined, options?: ParseDecimalOptions): number | null;
102
+ /**
103
+ * Safely parses a value into a boolean.
104
+ * Returns `null` if the value cannot be interpreted as boolean.
105
+ *
106
+ * - `null` or `undefined` → `null`
107
+ * - `boolean` → returned as-is
108
+ * - `number` → `0` is `false`, any other finite number is `true`
109
+ * - `string` → matched case-insensitively against known truthy/falsy values
110
+ *
111
+ * Default truthy: `"true"`, `"1"`, `"yes"`, `"si"`, `"sí"`, `"on"`
112
+ * Default falsy: `"false"`, `"0"`, `"no"`, `"off"`
113
+ *
114
+ * @param value - The value to parse.
115
+ * @param options - Optional parsing configuration.
116
+ * @returns The parsed boolean, or `null` on failure.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * parseBoolean(true) // true
121
+ * parseBoolean(false) // false
122
+ * parseBoolean(1) // true
123
+ * parseBoolean(0) // false
124
+ * parseBoolean(null) // null
125
+ * parseBoolean(undefined) // null
126
+ * parseBoolean("yes") // true
127
+ * parseBoolean("no") // false
128
+ * parseBoolean("sí") // true
129
+ * parseBoolean("TRUE") // true
130
+ * parseBoolean("oui") // null
131
+ * parseBoolean("oui", { extraTruthy: ["oui"] }) // true
132
+ * parseBoolean("nein", { extraFalsy: ["nein"] }) // false
133
+ * parseBoolean("whatever") // null
134
+ * ```
135
+ */
15
136
  export declare function parseBoolean(value: string | number | boolean | null | undefined, options?: ParseBooleanOptions): boolean | null;
16
137
  //# sourceMappingURL=parse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAMhC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAOvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAKD,MAAM,WAAW,mBAAmB;IAKhC,KAAK,CAAC,EAAE,MAAM,CAAC;IAOf,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAKD,MA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GAClC,MAAM,GAAG,IAAI,CAiBf;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,OAAO,GAAE,mBAAwB,GAClC,MAAM,GAAG,IAAI,CAwBf;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EACnD,OAAO,GAAE,mBAAwB,GAClC,OAAO,GAAG,IAAI,CAsBhB"}
@@ -1,9 +1,60 @@
1
+ /**
2
+ * Ensures that a given string has a specific prefix.
3
+ *
4
+ * @param {string} str - The string to ensure the prefix on.
5
+ * @param {string} prefix - The prefix to ensure on the string.
6
+ * @return {string} - The resulting string with the ensured prefix.
7
+ */
1
8
  export declare function ensurePrefix(str: string, prefix: string): string;
9
+ /**
10
+ * Ensures that a string ends with a specified suffix.
11
+ *
12
+ * @param {string} str - The original string.
13
+ * @param {string} suffix - The suffix to ensure.
14
+ * @return {string} - The modified string with the suffix added if it was not already present.
15
+ */
2
16
  export declare function ensureSuffix(str: string, suffix: string): string;
17
+ /**
18
+ * Formats a string using a template and provided arguments.
19
+ *
20
+ * @param {string} template - The template string containing placeholders.
21
+ * @param {any[]} args - Optional arguments to replace the placeholders in the template.
22
+ * @return {string} The formatted string.
23
+ */
3
24
  export declare function format(template: string, ...args: any[]): string;
25
+ /**
26
+ * Converts a string to snake_case.
27
+ *
28
+ * @param {string} str - The string to convert.
29
+ * @return {string} - The string converted to snake_case.
30
+ */
4
31
  export declare function toSnakeCase(str: string): string;
32
+ /**
33
+ * Converts a string to kebab-case.
34
+ *
35
+ * @param {string} str - The string to convert.
36
+ * @return {string} - The string converted to kebab-case.
37
+ */
5
38
  export declare function toKebabCase(str: string): string;
39
+ /**
40
+ * Converts a string to camelCase.
41
+ *
42
+ * @param {string} str - The string to convert.
43
+ * @return {string} - The string converted to camelCase.
44
+ */
6
45
  export declare function toCamelCase(str: string): string;
46
+ /**
47
+ * Converts a string to PascalCase.
48
+ *
49
+ * @param {string} str - The string to convert.
50
+ * @return {string} - The string converted to PascalCase.
51
+ */
7
52
  export declare function toPascalCase(str: string): string;
53
+ /**
54
+ * Converts a string to CONSTANT_CASE (a.k.a. SCREAMING_SNAKE_CASE).
55
+ *
56
+ * @param {string} str - The string to convert.
57
+ * @return {string} - The string converted to CONSTANT_CASE.
58
+ */
8
59
  export declare function toConstantCase(str: string): string;
9
60
  //# sourceMappingURL=string.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/string.ts"],"names":[],"mappings":"AAQA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIhE;AAUD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIhE;AASD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAa/D;AAgCD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAQD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAQD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/C;AAQD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAQD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD"}
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,CAa/D;AA0BD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -1,7 +1,14 @@
1
+ /**
2
+ * A class representing a timer that executes a callback function at a specified interval.
3
+ */
1
4
  export default class Timer {
2
5
  private _callback;
3
6
  private _interval;
4
7
  private _intervalId;
8
+ /**
9
+ * @param callback Callback
10
+ * @param interval Seconds between calls
11
+ */
5
12
  constructor(callback: () => void, interval: number);
6
13
  get running(): boolean;
7
14
  get interval(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/timer.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,KAAK;IAEtB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAa;gBAMpB,QAAQ,EAAE,MAAM,IAAI,EAAE,QAAQ,EAAE,MAAM;IAOlD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMzB;IAED,IAAI,QAAQ,IAAI,MAAM,IAAI,CAEzB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,EAI7B;IAGD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IAOZ,OAAO,IAAI,IAAI;CAIlB"}
1
+ {"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../../src/timer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,KAAK;IAEtB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAa;IAEhC;;;OAGG;gBACS,QAAQ,EAAE,MAAM,IAAI,EAAE,QAAQ,EAAE,MAAM;IAOlD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMzB;IAED,IAAI,QAAQ,IAAI,MAAM,IAAI,CAEzB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,EAI7B;IAGD,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,IAAI;IAOZ,OAAO,IAAI,IAAI;CAIlB"}
@@ -1,47 +1,249 @@
1
+ /**
2
+ * Represents a duration of time in milliseconds.
3
+ */
1
4
  export default class TimeSpan {
2
5
  milliseconds: number;
3
6
  private constructor();
7
+ /**
8
+ * Gets the time interval in seconds.
9
+ * @returns {number} The duration in seconds.
10
+ */
4
11
  seconds(): number;
12
+ /**
13
+ * Gets the time interval in minutes.
14
+ * @returns {number} The duration in minutes.
15
+ */
5
16
  minutes(): number;
17
+ /**
18
+ * Gets the time interval in hours.
19
+ * @returns {number} The duration in hours.
20
+ */
6
21
  hours(): number;
22
+ /**
23
+ * Gets the time interval in days.
24
+ * @returns {number} The duration in days.
25
+ */
7
26
  days(): number;
27
+ /**
28
+ * Gets the time interval in weeks.
29
+ * @returns {number} The duration in weeks.
30
+ */
8
31
  weeks(): number;
32
+ /**
33
+ * Creates a TimeSpan from a specified number of milliseconds.
34
+ * @param {number} milliseconds - The number of milliseconds.
35
+ * @returns {TimeSpan} A new TimeSpan instance.
36
+ */
9
37
  static fromMilliseconds(milliseconds: number): TimeSpan;
38
+ /**
39
+ * Creates a TimeSpan from a specified number of seconds.
40
+ * @param {number} seconds - The number of seconds.
41
+ * @returns {TimeSpan} A new TimeSpan instance.
42
+ */
10
43
  static fromSeconds(seconds: number): TimeSpan;
44
+ /**
45
+ * Creates a TimeSpan from a specified number of minutes.
46
+ * @param {number} minutes - The number of minutes.
47
+ * @returns {TimeSpan} A new TimeSpan instance.
48
+ */
11
49
  static fromMinutes(minutes: number): TimeSpan;
50
+ /**
51
+ * Creates a TimeSpan from a specified number of hours.
52
+ * @param {number} hours - The number of hours.
53
+ * @returns {TimeSpan} A new TimeSpan instance.
54
+ */
12
55
  static fromHours(hours: number): TimeSpan;
56
+ /**
57
+ * Creates a TimeSpan from a specified number of days.
58
+ * @param {number} days - The number of days.
59
+ * @returns {TimeSpan} A new TimeSpan instance.
60
+ */
13
61
  static fromDays(days: number): TimeSpan;
62
+ /**
63
+ * Creates a TimeSpan from a specified number of weeks.
64
+ * @param {number} weeks - The number of weeks.
65
+ * @returns {TimeSpan} A new TimeSpan instance.
66
+ */
14
67
  static fromWeeks(weeks: number): TimeSpan;
68
+ /**
69
+ * Returns a new TimeSpan that adds the specified number of milliseconds to this instance.
70
+ * @param {number} milliseconds - The milliseconds to add.
71
+ * @returns {TimeSpan} A new TimeSpan instance.
72
+ */
15
73
  addMilliseconds(milliseconds: number): TimeSpan;
74
+ /**
75
+ * Returns a new TimeSpan that adds the specified number of seconds to this instance.
76
+ * @param {number} seconds - The seconds to add.
77
+ * @returns {TimeSpan} A new TimeSpan instance.
78
+ */
16
79
  addSeconds(seconds: number): TimeSpan;
80
+ /**
81
+ * Returns a new TimeSpan that adds the specified number of minutes to this instance.
82
+ * @param {number} minutes - The minutes to add.
83
+ * @returns {TimeSpan} A new TimeSpan instance.
84
+ */
17
85
  addMinutes(minutes: number): TimeSpan;
86
+ /**
87
+ * Returns a new TimeSpan that adds the specified number of hours to this instance.
88
+ * @param {number} hours - The hours to add.
89
+ * @returns {TimeSpan} A new TimeSpan instance.
90
+ */
18
91
  addHours(hours: number): TimeSpan;
92
+ /**
93
+ * Returns a new TimeSpan that adds the specified number of days to this instance.
94
+ * @param {number} days - The days to add.
95
+ * @returns {TimeSpan} A new TimeSpan instance.
96
+ */
19
97
  addDays(days: number): TimeSpan;
98
+ /**
99
+ * Returns a new TimeSpan that adds the specified number of weeks to this instance.
100
+ * @param {number} weeks - The weeks to add.
101
+ * @returns {TimeSpan} A new TimeSpan instance.
102
+ */
20
103
  addWeeks(weeks: number): TimeSpan;
104
+ /**
105
+ * Returns a new TimeSpan that subtracts the specified number of milliseconds from this instance.
106
+ * @param {number} milliseconds - The milliseconds to subtract.
107
+ * @returns {TimeSpan} A new TimeSpan instance.
108
+ */
21
109
  subtractMilliseconds(milliseconds: number): TimeSpan;
110
+ /**
111
+ * Returns a new TimeSpan that subtracts the specified number of seconds from this instance.
112
+ * @param {number} seconds - The seconds to subtract.
113
+ * @returns {TimeSpan} A new TimeSpan instance.
114
+ */
22
115
  subtractSeconds(seconds: number): TimeSpan;
116
+ /**
117
+ * Returns a new TimeSpan that subtracts the specified number of minutes from this instance.
118
+ * @param {number} minutes - The minutes to subtract.
119
+ * @returns {TimeSpan} A new TimeSpan instance.
120
+ */
23
121
  subtractMinutes(minutes: number): TimeSpan;
122
+ /**
123
+ * Returns a new TimeSpan that subtracts the specified number of hours from this instance.
124
+ * @param {number} hours - The hours to subtract.
125
+ * @returns {TimeSpan} A new TimeSpan instance.
126
+ */
24
127
  subtractHours(hours: number): TimeSpan;
128
+ /**
129
+ * Returns a new TimeSpan that subtracts the specified number of days from this instance.
130
+ * @param {number} days - The days to subtract.
131
+ * @returns {TimeSpan} A new TimeSpan instance.
132
+ */
25
133
  subtractDays(days: number): TimeSpan;
134
+ /**
135
+ * Returns a new TimeSpan that subtracts the specified number of weeks from this instance.
136
+ * @param {number} weeks - The weeks to subtract.
137
+ * @returns {TimeSpan} A new TimeSpan instance.
138
+ */
26
139
  subtractWeeks(weeks: number): TimeSpan;
140
+ /**
141
+ * Returns a new TimeSpan that adds the specified TimeSpan to this instance.
142
+ * @param {TimeSpan} other - The TimeSpan to add.
143
+ * @returns {TimeSpan} A new TimeSpan instance.
144
+ */
27
145
  add(other: TimeSpan): TimeSpan;
146
+ /**
147
+ * Returns a new TimeSpan that subtracts the specified TimeSpan from this instance.
148
+ * @param {TimeSpan} other - The TimeSpan to subtract.
149
+ * @returns {TimeSpan} A new TimeSpan instance.
150
+ */
28
151
  subtract(other: TimeSpan): TimeSpan;
152
+ /**
153
+ * Adds this TimeSpan to a specified Date.
154
+ * @param {Date} date - The date to add to.
155
+ * @returns {Date} A new Date instance.
156
+ */
29
157
  addTo(date: Date): Date;
158
+ /**
159
+ * Subtracts this TimeSpan from a specified Date.
160
+ * @param {Date} date - The date to subtract from.
161
+ * @returns {Date} A new Date instance.
162
+ */
30
163
  subtractFrom(date: Date): Date;
164
+ /**
165
+ * Creates a TimeSpan from the difference between two dates.
166
+ * @param {Date} earlierDate - The earlier date.
167
+ * @param {Date} laterDate - The later date.
168
+ * @returns {TimeSpan} A new TimeSpan instance representing the difference.
169
+ */
31
170
  static fromDifference(earlierDate: Date, laterDate: Date): TimeSpan;
171
+ /**
172
+ * Formats the TimeSpan as a string.
173
+ * Supported tokens: hh, h, mm, m, ss, s.
174
+ * @param {string} format - The format string (default: 'hh:mm:ss').
175
+ * @returns {string} The formatted string.
176
+ */
32
177
  format(format?: string): string;
178
+ /**
179
+ * Checks if this TimeSpan is equal to another.
180
+ * @param {TimeSpan} other - The other TimeSpan.
181
+ * @returns {boolean} True if equal.
182
+ */
33
183
  eq(other: TimeSpan): boolean;
184
+ /**
185
+ * Checks if this TimeSpan is less than or equal to another.
186
+ * @param {TimeSpan} other - The other TimeSpan.
187
+ * @returns {boolean} True if less than or equal.
188
+ */
34
189
  le(other: TimeSpan): boolean;
190
+ /**
191
+ * Checks if this TimeSpan is less than another.
192
+ * @param {TimeSpan} other - The other TimeSpan.
193
+ * @returns {boolean} True if less than.
194
+ */
35
195
  lt(other: TimeSpan): boolean;
196
+ /**
197
+ * Checks if this TimeSpan is greater than or equal to another.
198
+ * @param {TimeSpan} other - The other TimeSpan.
199
+ * @returns {boolean} True if greater than or equal.
200
+ */
36
201
  ge(other: TimeSpan): boolean;
202
+ /**
203
+ * Checks if this TimeSpan is greater than another.
204
+ * @param {TimeSpan} other - The other TimeSpan.
205
+ * @returns {boolean} True if greater than.
206
+ */
37
207
  gt(other: TimeSpan): boolean;
208
+ /**
209
+ * Multiplies the TimeSpan by a number.
210
+ * @param {number} number - The multiplier.
211
+ * @returns {TimeSpan} A new TimeSpan instance.
212
+ */
38
213
  multiply(number: number): TimeSpan;
214
+ /**
215
+ * Divides the TimeSpan by a number.
216
+ * @param {number} number - The divisor.
217
+ * @returns {TimeSpan} A new TimeSpan instance.
218
+ */
39
219
  divide(number: number): TimeSpan;
220
+ /**
221
+ * Returns the absolute value of the TimeSpan.
222
+ * @returns {TimeSpan} A new TimeSpan instance.
223
+ */
40
224
  abs(): TimeSpan;
225
+ /**
226
+ * Infinite duration.
227
+ */
41
228
  static readonly INFINITE: TimeSpan;
229
+ /**
230
+ * Negative infinite duration.
231
+ */
42
232
  static readonly NEGATIVE_INFINITE: TimeSpan;
233
+ /**
234
+ * Checks if the TimeSpan is infinite.
235
+ * @returns {boolean} True if infinite.
236
+ */
43
237
  isInfinite(): boolean;
238
+ /**
239
+ * Checks if the TimeSpan is positive infinite.
240
+ * @returns {boolean} True if positive infinite.
241
+ */
44
242
  isPositiveInfinite(): boolean;
243
+ /**
244
+ * Checks if the TimeSpan is negative infinite.
245
+ * @returns {boolean} True if negative infinite.
246
+ */
45
247
  isNegativeInfinite(): boolean;
46
248
  }
47
249
  //# sourceMappingURL=timespan.d.ts.map