@develia/commons 0.4.14 → 0.4.16

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 (230) hide show
  1. package/dist/cjs/array.js +43 -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 +16 -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/range.js +154 -0
  43. package/dist/cjs/range.js.map +1 -0
  44. package/dist/cjs/stopwatch.js +10 -0
  45. package/dist/cjs/stopwatch.js.map +1 -1
  46. package/dist/cjs/string.js +62 -0
  47. package/dist/cjs/string.js.map +1 -1
  48. package/dist/cjs/timer.js +7 -0
  49. package/dist/cjs/timer.js.map +1 -1
  50. package/dist/cjs/timespan.js +202 -0
  51. package/dist/cjs/timespan.js.map +1 -1
  52. package/dist/cjs/type-code.js.map +1 -1
  53. package/dist/cjs/type.js +80 -1
  54. package/dist/cjs/type.js.map +1 -1
  55. package/dist/cjs/types.js.map +1 -1
  56. package/dist/cjs/utilities.js +183 -0
  57. package/dist/cjs/utilities.js.map +1 -1
  58. package/dist/esm/array.js +42 -1
  59. package/dist/esm/array.js.map +1 -1
  60. package/dist/esm/async-pool-executor.js +15 -0
  61. package/dist/esm/async-pool-executor.js.map +1 -1
  62. package/dist/esm/browser/form-utilities.js +26 -0
  63. package/dist/esm/browser/form-utilities.js.map +1 -1
  64. package/dist/esm/browser/geo-location.js +5 -0
  65. package/dist/esm/browser/geo-location.js.map +1 -1
  66. package/dist/esm/browser/index.js.map +1 -1
  67. package/dist/esm/browser/native-bridge.js +9 -0
  68. package/dist/esm/browser/native-bridge.js.map +1 -1
  69. package/dist/esm/cancellable-promise.js.map +1 -1
  70. package/dist/esm/clean-url-search-params.js +1 -0
  71. package/dist/esm/clean-url-search-params.js.map +1 -1
  72. package/dist/esm/collections/cache-dictionary.js +39 -0
  73. package/dist/esm/collections/cache-dictionary.js.map +1 -1
  74. package/dist/esm/collections/default-map.js +25 -1
  75. package/dist/esm/collections/default-map.js.map +1 -1
  76. package/dist/esm/collections/default-weak-map.js +22 -2
  77. package/dist/esm/collections/default-weak-map.js.map +1 -1
  78. package/dist/esm/{from.js → collections/from.js} +278 -4
  79. package/dist/esm/collections/from.js.map +1 -0
  80. package/dist/esm/collections/index.js +1 -0
  81. package/dist/esm/collections/index.js.map +1 -1
  82. package/dist/esm/draft.js +37 -0
  83. package/dist/esm/draft.js.map +1 -1
  84. package/dist/esm/event-bus.js +1 -0
  85. package/dist/esm/event-bus.js.map +1 -1
  86. package/dist/esm/index.js +14 -1
  87. package/dist/esm/index.js.map +1 -1
  88. package/dist/esm/key-value-pair.js +6 -0
  89. package/dist/esm/key-value-pair.js.map +1 -1
  90. package/dist/esm/lazy.js +4 -0
  91. package/dist/esm/lazy.js.map +1 -1
  92. package/dist/esm/math.js +19 -0
  93. package/dist/esm/math.js.map +1 -1
  94. package/dist/esm/order.js.map +1 -1
  95. package/dist/esm/parse.js +96 -0
  96. package/dist/esm/parse.js.map +1 -1
  97. package/dist/esm/patch.js +10 -2
  98. package/dist/esm/patch.js.map +1 -1
  99. package/dist/esm/range.js +151 -0
  100. package/dist/esm/range.js.map +1 -0
  101. package/dist/esm/stopwatch.js +10 -0
  102. package/dist/esm/stopwatch.js.map +1 -1
  103. package/dist/esm/string.js +62 -0
  104. package/dist/esm/string.js.map +1 -1
  105. package/dist/esm/timer.js +7 -0
  106. package/dist/esm/timer.js.map +1 -1
  107. package/dist/esm/timespan.js +202 -0
  108. package/dist/esm/timespan.js.map +1 -1
  109. package/dist/esm/type-code.js.map +1 -1
  110. package/dist/esm/type.js +80 -1
  111. package/dist/esm/type.js.map +1 -1
  112. package/dist/esm/types.js.map +1 -1
  113. package/dist/esm/utilities.js +183 -0
  114. package/dist/esm/utilities.js.map +1 -1
  115. package/dist/types/array.d.ts +35 -0
  116. package/dist/types/array.d.ts.map +1 -1
  117. package/dist/types/async-pool-executor.d.ts +15 -0
  118. package/dist/types/async-pool-executor.d.ts.map +1 -1
  119. package/dist/types/browser/form-utilities.d.ts +13 -0
  120. package/dist/types/browser/form-utilities.d.ts.map +1 -1
  121. package/dist/types/browser/index.d.ts.map +1 -1
  122. package/dist/types/browser/native-bridge.d.ts +6 -0
  123. package/dist/types/browser/native-bridge.d.ts.map +1 -1
  124. package/dist/types/collections/cache-dictionary.d.ts +39 -0
  125. package/dist/types/collections/cache-dictionary.d.ts.map +1 -1
  126. package/dist/types/collections/default-map.d.ts +23 -0
  127. package/dist/types/collections/default-map.d.ts.map +1 -1
  128. package/dist/types/collections/default-weak-map.d.ts +20 -1
  129. package/dist/types/collections/default-weak-map.d.ts.map +1 -1
  130. package/dist/types/collections/from.d.ts +333 -0
  131. package/dist/types/collections/from.d.ts.map +1 -0
  132. package/dist/types/collections/index.d.ts +1 -0
  133. package/dist/types/collections/index.d.ts.map +1 -1
  134. package/dist/types/draft.d.ts +68 -0
  135. package/dist/types/draft.d.ts.map +1 -1
  136. package/dist/types/index.d.ts +5 -1
  137. package/dist/types/index.d.ts.map +1 -1
  138. package/dist/types/key-value-pair.d.ts +6 -0
  139. package/dist/types/key-value-pair.d.ts.map +1 -1
  140. package/dist/types/lazy.d.ts +4 -0
  141. package/dist/types/lazy.d.ts.map +1 -1
  142. package/dist/types/math.d.ts +19 -0
  143. package/dist/types/math.d.ts.map +1 -1
  144. package/dist/types/parse.d.ts +121 -0
  145. package/dist/types/parse.d.ts.map +1 -1
  146. package/dist/types/range.d.ts +72 -0
  147. package/dist/types/range.d.ts.map +1 -0
  148. package/dist/types/string.d.ts +51 -0
  149. package/dist/types/string.d.ts.map +1 -1
  150. package/dist/types/timer.d.ts +7 -0
  151. package/dist/types/timer.d.ts.map +1 -1
  152. package/dist/types/timespan.d.ts +202 -0
  153. package/dist/types/timespan.d.ts.map +1 -1
  154. package/dist/types/type.d.ts +40 -0
  155. package/dist/types/type.d.ts.map +1 -1
  156. package/dist/types/utilities.d.ts +171 -0
  157. package/dist/types/utilities.d.ts.map +1 -1
  158. package/dist/web/array.js +42 -1
  159. package/dist/web/array.js.map +1 -1
  160. package/dist/web/async-pool-executor.js +15 -0
  161. package/dist/web/async-pool-executor.js.map +1 -1
  162. package/dist/web/browser/form-utilities.js +26 -0
  163. package/dist/web/browser/form-utilities.js.map +1 -1
  164. package/dist/web/browser/geo-location.js +5 -0
  165. package/dist/web/browser/geo-location.js.map +1 -1
  166. package/dist/web/browser/index.js.map +1 -1
  167. package/dist/web/browser/native-bridge.js +9 -0
  168. package/dist/web/browser/native-bridge.js.map +1 -1
  169. package/dist/web/cancellable-promise.js.map +1 -1
  170. package/dist/web/clean-url-search-params.js +1 -0
  171. package/dist/web/clean-url-search-params.js.map +1 -1
  172. package/dist/web/collections/cache-dictionary.js +39 -0
  173. package/dist/web/collections/cache-dictionary.js.map +1 -1
  174. package/dist/web/collections/default-map.js +25 -1
  175. package/dist/web/collections/default-map.js.map +1 -1
  176. package/dist/web/collections/default-weak-map.js +22 -2
  177. package/dist/web/collections/default-weak-map.js.map +1 -1
  178. package/dist/web/{from.js → collections/from.js} +279 -5
  179. package/dist/web/collections/from.js.map +1 -0
  180. package/dist/web/collections/index.js +1 -0
  181. package/dist/web/collections/index.js.map +1 -1
  182. package/dist/web/draft.js +37 -0
  183. package/dist/web/draft.js.map +1 -1
  184. package/dist/web/event-bus.js +1 -0
  185. package/dist/web/event-bus.js.map +1 -1
  186. package/dist/web/index.js +14 -1
  187. package/dist/web/index.js.map +1 -1
  188. package/dist/web/key-value-pair.js +6 -0
  189. package/dist/web/key-value-pair.js.map +1 -1
  190. package/dist/web/lazy.js +4 -0
  191. package/dist/web/lazy.js.map +1 -1
  192. package/dist/web/math.js +19 -0
  193. package/dist/web/math.js.map +1 -1
  194. package/dist/web/order.js.map +1 -1
  195. package/dist/web/parse.js +96 -0
  196. package/dist/web/parse.js.map +1 -1
  197. package/dist/web/patch.js +10 -2
  198. package/dist/web/patch.js.map +1 -1
  199. package/dist/web/range.js +151 -0
  200. package/dist/web/range.js.map +1 -0
  201. package/dist/web/stopwatch.js +10 -0
  202. package/dist/web/stopwatch.js.map +1 -1
  203. package/dist/web/string.js +62 -0
  204. package/dist/web/string.js.map +1 -1
  205. package/dist/web/timer.js +7 -0
  206. package/dist/web/timer.js.map +1 -1
  207. package/dist/web/timespan.js +202 -0
  208. package/dist/web/timespan.js.map +1 -1
  209. package/dist/web/type-code.js.map +1 -1
  210. package/dist/web/type.js +80 -1
  211. package/dist/web/type.js.map +1 -1
  212. package/dist/web/types.js.map +1 -1
  213. package/dist/web/utilities.js +183 -0
  214. package/dist/web/utilities.js.map +1 -1
  215. package/package.json +1 -1
  216. package/src/array.ts +16 -0
  217. package/src/browser/index.ts +2 -2
  218. package/src/collections/cache-dictionary.ts +39 -1
  219. package/src/collections/default-map.ts +15 -9
  220. package/src/collections/default-weak-map.ts +14 -12
  221. package/src/{from.ts → collections/from.ts} +285 -15
  222. package/src/collections/index.ts +4 -3
  223. package/src/index.ts +43 -42
  224. package/src/range.ts +165 -0
  225. package/src/timespan.ts +199 -20
  226. package/dist/cjs/from.js.map +0 -1
  227. package/dist/esm/from.js.map +0 -1
  228. package/dist/types/from.d.ts +0 -59
  229. package/dist/types/from.d.ts.map +0 -1
  230. package/dist/web/from.js.map +0 -1
@@ -0,0 +1,333 @@
1
+ import type { Consumer, EqualityComparer, UnaryFunction, Predicate, Supplier, Optional } from "../types.js";
2
+ import KeyValuePair from "../key-value-pair.js";
3
+ import Order from "../order.js";
4
+ /**
5
+ * Creates a new From instance from an Iterable or a Supplier of an Iterable.
6
+ * @template T - The type of elements in the source.
7
+ * @param {Iterable<T> | Supplier<Iterable<T>>} source - The source data.
8
+ * @returns {From<T> | From<KeyValuePair<any, any>>} A new From instance.
9
+ * @throws {string} If source is null or invalid.
10
+ */
11
+ export default function from<T>(source: Iterable<T> | Supplier<Iterable<T>>): From<T> | From<KeyValuePair<any, any>>;
12
+ /**
13
+ * A LINQ-like wrapper for iterables that provides various transformation and query methods.
14
+ * @template T - The type of elements in the sequence.
15
+ */
16
+ export declare class From<T> implements Iterable<T> {
17
+ /**
18
+ * Creates a From instance from an object's entries.
19
+ * @param {any} obj - The object to convert to pairs.
20
+ * @returns {From<KeyValuePair<any, any>>} A From instance of key-value pairs.
21
+ */
22
+ static object(obj: any): From<KeyValuePair<any, any>>;
23
+ private readonly _fn;
24
+ protected constructor(fn: Supplier<Iterable<T>>);
25
+ /**
26
+ * Creates a From instance from a supplier function.
27
+ * @template T
28
+ * @param {Supplier<Iterable<T>>} callable - A function that returns an Iterable.
29
+ * @returns {From<T>} A new From instance.
30
+ */
31
+ static fn<T>(callable: Supplier<Iterable<T>>): From<T>;
32
+ /**
33
+ * Collects all elements into an array and returns a new From instance from it.
34
+ * Useful for freezing the sequence and preventing multiple iterations over a generator.
35
+ * @returns {From<T>} A new From instance with cached data.
36
+ */
37
+ collect(): From<T>;
38
+ /**
39
+ * Creates a From instance from an Iterable.
40
+ * @template T
41
+ * @param {Iterable<T>} iterable - The source iterable.
42
+ * @returns {From<T>} A new From instance.
43
+ */
44
+ static iterable<T>(iterable: Iterable<T>): From<T>;
45
+ /**
46
+ * Maps each element of the sequence into a new form.
47
+ * @template R
48
+ * @param {UnaryFunction<T, R>} mapper - A transformation function.
49
+ * @returns {From<R>} A new From instance with the mapped elements.
50
+ */
51
+ map<R>(mapper: UnaryFunction<T, R>): From<R>;
52
+ [Symbol.iterator](): Iterator<T>;
53
+ /**
54
+ * Checks if all elements in the sequence satisfy the given predicate.
55
+ * @param {Predicate<T>} predicate - A function to test each element.
56
+ * @returns {boolean} True if all elements satisfy the predicate.
57
+ */
58
+ all(predicate: Predicate<T>): boolean;
59
+ /**
60
+ * Checks if any element in the sequence satisfies the given predicate.
61
+ * If no predicate is provided, checks if the sequence is not empty.
62
+ * @param {Optional<Predicate<T>>} predicate - A function to test each element.
63
+ * @returns {boolean} True if any element satisfies the predicate.
64
+ */
65
+ any(predicate?: Optional<Predicate<T>>): boolean;
66
+ /**
67
+ * Gets the number of elements in the sequence.
68
+ * @returns {number} The count of elements.
69
+ */
70
+ get length(): number;
71
+ /**
72
+ * Counts the number of elements that satisfy the given predicate.
73
+ * If no predicate is provided, counts all elements.
74
+ * @param {Optional<Predicate<T>>} predicate - A function to test each element.
75
+ * @returns {number} The count of elements.
76
+ */
77
+ count(predicate?: Optional<Predicate<T>>): number;
78
+ /**
79
+ * Filters the sequence based on a predicate.
80
+ * @param {Predicate<T>} predicate - A function to test each element.
81
+ * @returns {From<T>} A new From instance with the filtered elements.
82
+ */
83
+ filter(predicate: Predicate<T>): From<T>;
84
+ /**
85
+ * Checks if the sequence contains a specific value.
86
+ * @param {T} value - The value to search for.
87
+ * @returns {boolean} True if the value is found.
88
+ */
89
+ contains(value: T): boolean;
90
+ /**
91
+ * Returns the first element of the sequence that satisfies a condition.
92
+ * @param {Predicate<T>} [predicate] - Optional condition.
93
+ * @returns {T | undefined} The first element or undefined.
94
+ */
95
+ first(predicate?: Predicate<T>): T | undefined;
96
+ /**
97
+ * Returns the only element of the sequence that satisfies a condition, or throws if more than one exists.
98
+ * @param {Predicate<T>} [predicate] - Optional condition.
99
+ * @returns {T | null} The single element or null if not found.
100
+ * @throws {Error} If more than one element is found.
101
+ */
102
+ single(predicate?: Predicate<T>): T | null;
103
+ /**
104
+ * Appends an item to the end of the sequence.
105
+ * @param {T} item - The item to append.
106
+ * @returns {From<T>} A new From instance.
107
+ */
108
+ append(item: T): From<T>;
109
+ /**
110
+ * Prepends an item to the beginning of the sequence.
111
+ * @param {T} item - The item to prepend.
112
+ * @returns {From<T>} A new From instance.
113
+ */
114
+ prepend(item: T): From<T>;
115
+ /**
116
+ * Gets the element at a specific index.
117
+ * @param {number} index - The zero-based index.
118
+ * @returns {T | undefined} The element at the index or undefined.
119
+ */
120
+ at(index: number): T | undefined;
121
+ /**
122
+ * Returns the last element of the sequence that satisfies a condition.
123
+ * @param {Predicate<T>} [predicate] - Optional condition.
124
+ * @returns {T | undefined} The last element or undefined.
125
+ */
126
+ last(predicate?: Predicate<T>): T | undefined;
127
+ /**
128
+ * Projects each element of a sequence to an Iterable and flattens the resulting sequences into one sequence.
129
+ * @template R
130
+ * @param {UnaryFunction<T, Iterable<R>>} mapper - A transformation function.
131
+ * @returns {From<R>} A new From instance.
132
+ */
133
+ mapMany<R>(mapper: UnaryFunction<T, Iterable<R>>): From<R>;
134
+ /**
135
+ * Flattens a sequence of iterables.
136
+ * @returns {From<any>} A new From instance.
137
+ */
138
+ flatten(): From<any>;
139
+ /**
140
+ * Calculates the sum of the elements in the sequence.
141
+ * @param {UnaryFunction<T, number>} [mapper] - Optional projection function.
142
+ * @returns {number} The sum.
143
+ */
144
+ sum(mapper?: UnaryFunction<T, number>): number;
145
+ /**
146
+ * Calculates the average of the elements in the sequence.
147
+ * @param {UnaryFunction<T, number>} [mapper] - Optional projection function.
148
+ * @returns {number} The average.
149
+ */
150
+ avg(mapper?: UnaryFunction<T, number>): number;
151
+ /**
152
+ * Returns the maximum value in the sequence.
153
+ * @param {UnaryFunction<T, number>} mapper - Projection function.
154
+ * @returns {number} The maximum value.
155
+ */
156
+ max(mapper: UnaryFunction<T, number>): number;
157
+ /**
158
+ * Returns the minimum value in the sequence.
159
+ * @param {UnaryFunction<T, number>} mapper - Projection function.
160
+ * @returns {number} The minimum value.
161
+ */
162
+ min(mapper: UnaryFunction<T, number>): number;
163
+ /**
164
+ * Returns the element with the maximum value.
165
+ * @param {UnaryFunction<T, number>} mapper - Projection function.
166
+ * @returns {T | undefined} The element with the maximum value.
167
+ */
168
+ maxBy(mapper: UnaryFunction<T, number>): T | undefined;
169
+ /**
170
+ * Returns the element with the minimum value.
171
+ * @param {UnaryFunction<T, number>} mapper - Projection function.
172
+ * @returns {T | undefined} The element with the minimum value.
173
+ */
174
+ minBy(mapper: UnaryFunction<T, number>): T | undefined;
175
+ /**
176
+ * Sorts the elements of the sequence.
177
+ * @template R
178
+ * @param {UnaryFunction<T, R>} mapper - Projection function for the key to sort by.
179
+ * @param {Order} [order] - Ascending or Descending.
180
+ * @returns {From<T>} A new From instance.
181
+ */
182
+ orderBy<R>(mapper: UnaryFunction<T, R>, order?: Order): From<T>;
183
+ /**
184
+ * Groups the elements of the sequence.
185
+ * @template TKey
186
+ * @param {UnaryFunction<T, TKey>} keySelector - Function to extract the key for each element.
187
+ * @param {EqualityComparer<TKey>} [equalityComparer] - Optional comparer for keys.
188
+ * @returns {From<Grouping<TKey, T>>} A new From instance.
189
+ */
190
+ groupBy<TKey>(keySelector: UnaryFunction<T, TKey>, equalityComparer?: EqualityComparer<TKey>): From<Grouping<TKey, T>>;
191
+ /**
192
+ * Returns a specified number of contiguous elements from the start of the sequence.
193
+ * @param {number} n - The number of elements to return.
194
+ * @returns {From<T>} A new From instance.
195
+ */
196
+ head(n: number): From<T>;
197
+ /**
198
+ * Returns a specified number of contiguous elements from the end of the sequence.
199
+ * @param {number} n - The number of elements to return.
200
+ * @returns {From<T>} A new From instance.
201
+ */
202
+ tail(n: number): From<T>;
203
+ /**
204
+ * Performs the specified action on each element of the sequence.
205
+ * @param {Consumer<T>} action - The action to perform.
206
+ */
207
+ forEach(action: Consumer<T>): void;
208
+ /**
209
+ * Converts the sequence to an array.
210
+ * @returns {T[]} The array.
211
+ */
212
+ toArray(): T[];
213
+ /**
214
+ * Converts the sequence to a record.
215
+ * @template R
216
+ * @param {UnaryFunction<T, string | symbol | number>} keySelector - Key selector.
217
+ * @param {UnaryFunction<T, R>} valueSelector - Value selector.
218
+ * @returns {Record<string | symbol | number, R>} The record.
219
+ */
220
+ toRecord<R>(keySelector: UnaryFunction<T, string | symbol | number>, valueSelector: UnaryFunction<T, R>): Record<string | symbol | number, R>;
221
+ /**
222
+ * Converts the sequence to a Map.
223
+ * @template RKey, RValue
224
+ * @param {UnaryFunction<T, RKey>} keySelector - Key selector.
225
+ * @param {UnaryFunction<T, RValue>} valueSelector - Value selector.
226
+ * @returns {Map<RKey, RValue>} The map.
227
+ */
228
+ toMap<RKey, RValue>(keySelector: UnaryFunction<T, RKey>, valueSelector: UnaryFunction<T, RValue>): Map<RKey, RValue>;
229
+ /**
230
+ * Returns elements that are instances of a specific primitive type.
231
+ * @param {string} type - The type string (e.g., 'string', 'number').
232
+ * @returns {From<T>} A new From instance.
233
+ */
234
+ instancesOf(type: string): From<T>;
235
+ /**
236
+ * Checks if all elements are instances of a specific class.
237
+ * @param {new (...args: any[]) => any} type - The class constructor.
238
+ * @returns {boolean} True if all elements are instances of the type.
239
+ */
240
+ allInstanceOf(type: new (...args: any[]) => any): boolean;
241
+ /**
242
+ * Returns distinct elements from the sequence.
243
+ * @param {EqualityComparer<T>} [eq_comparer] - Optional equality comparer.
244
+ * @returns {From<T>} A new From instance.
245
+ */
246
+ distinct(eq_comparer?: EqualityComparer<T>): From<T>;
247
+ /**
248
+ * Inserts an item at a specific index.
249
+ * @param {T} item - The item to insert.
250
+ * @param {number} index - The zero-based index.
251
+ * @returns {From<T>} A new From instance.
252
+ */
253
+ insert(item: T, index: number): From<T>;
254
+ /**
255
+ * Bypasses a specified number of elements in a sequence and then returns the remaining elements.
256
+ * @param {number} n - The number of elements to skip.
257
+ * @returns {From<T>} A new From instance.
258
+ */
259
+ skip(n: number): From<T>;
260
+ /**
261
+ * Concatenates two sequences.
262
+ * @param {Iterable<T>} other - The other sequence.
263
+ * @returns {From<T>} A new From instance.
264
+ */
265
+ union(other: Iterable<T>): From<T>;
266
+ /**
267
+ * Correlates the elements of two sequences based on matching keys.
268
+ * @template T2, R, R2
269
+ * @param {Iterable<T2>} other - The other sequence.
270
+ * @param {UnaryFunction<T, R>} thisKeySelector - Key selector for this sequence.
271
+ * @param {UnaryFunction<T2, R>} otherKeySelector - Key selector for the other sequence.
272
+ * @param {(thisItem: T, otherItem: T2) => R2} resultSelector - Function to create a result element from two matching elements.
273
+ * @returns {From<R2>} A new From instance.
274
+ */
275
+ innerJoin<T2, R, R2>(other: Iterable<T2>, thisKeySelector: UnaryFunction<T, R>, otherKeySelector: UnaryFunction<T2, R>, resultSelector: (thisItem: T, otherItem: T2) => R2): From<R2>;
276
+ /**
277
+ * Performs a left join on two sequences.
278
+ * @template U, K, R
279
+ * @param {Iterable<U>} other - The other sequence.
280
+ * @param {UnaryFunction<T, K>} thisKeySelector - Key selector for this sequence.
281
+ * @param {UnaryFunction<U, K>} otherKeySelector - Key selector for the other sequence.
282
+ * @param {(thisItem: T, otherItem: U | undefined) => R} resultSelector - Function to create a result element.
283
+ * @returns {From<R>} A new From instance.
284
+ */
285
+ leftJoin<U, K, R>(other: Iterable<U>, thisKeySelector: UnaryFunction<T, K>, otherKeySelector: UnaryFunction<U, K>, resultSelector: (thisItem: T, otherItem: U | undefined) => R): From<R>;
286
+ /**
287
+ * Performs a left group join on two sequences.
288
+ * @template U, K, R
289
+ * @param {Iterable<U>} other - The other sequence.
290
+ * @param {UnaryFunction<T, K>} thisKeySelector - Key selector for this sequence.
291
+ * @param {UnaryFunction<U, K>} otherKeySelector - Key selector for the other sequence.
292
+ * @param {(thisItem: T, otherItems: Array<U>) => R} resultSelector - Function to create a result element.
293
+ * @returns {From<R>} A new From instance.
294
+ */
295
+ leftGroupJoin<U, K, R>(other: Iterable<U>, thisKeySelector: UnaryFunction<T, K>, otherKeySelector: UnaryFunction<U, K>, resultSelector: (thisItem: T, otherItems: Array<U>) => R): From<R>;
296
+ /**
297
+ * Performs a right group join on two sequences.
298
+ * @template U, K, R
299
+ * @param {Iterable<U>} other - The other sequence.
300
+ * @param {UnaryFunction<T, K>} thisKeySelector - Key selector for this sequence.
301
+ * @param {UnaryFunction<U, K>} otherKeySelector - Key selector for the other sequence.
302
+ * @param {(thisItems: Array<T>, otherItem: U) => R} resultSelector - Function to create a result element.
303
+ * @returns {From<R>} A new From instance.
304
+ */
305
+ rightGroupJoin<U, K, R>(other: Iterable<U>, thisKeySelector: UnaryFunction<T, K>, otherKeySelector: UnaryFunction<U, K>, resultSelector: (thisItems: Array<T>, otherItem: U) => R): From<R>;
306
+ /**
307
+ * Performs a right join on two sequences.
308
+ * @template U, K, R
309
+ * @param {Iterable<U>} other - The other sequence.
310
+ * @param {UnaryFunction<T, K>} thisKeySelector - Key selector for this sequence.
311
+ * @param {UnaryFunction<U, K>} otherKeySelector - Key selector for the other sequence.
312
+ * @param {(thisItem: T | undefined, otherItem: U) => R} resultSelector - Function to create a result element.
313
+ * @returns {From<R>} A new From instance.
314
+ */
315
+ rightJoin<U, K, R>(other: Iterable<U>, thisKeySelector: UnaryFunction<T, K>, otherKeySelector: UnaryFunction<U, K>, resultSelector: (thisItem: T | undefined, otherItem: U) => R): From<R>;
316
+ }
317
+ /**
318
+ * Represents a group of elements that have a common key.
319
+ * @template TKey, T
320
+ */
321
+ export declare class Grouping<TKey, T> extends From<T> {
322
+ private readonly _key;
323
+ /**
324
+ * Gets the key of the group.
325
+ */
326
+ get key(): TKey;
327
+ /**
328
+ * @param {TKey} key - The group key.
329
+ * @param {Array<T>} values - The values in the group.
330
+ */
331
+ constructor(key: TKey, values: Array<T>);
332
+ }
333
+ //# sourceMappingURL=from.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"from.d.ts","sourceRoot":"","sources":["../../../src/collections/from.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAW,MAAM,aAAa,CAAC;AAEpH,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,MAAM,aAAa,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAYnH;AAED;;;GAGG;AACH,qBAAa,IAAI,CAAC,CAAC,CAAE,YAAW,QAAQ,CAAC,CAAC,CAAC;IAEvC;;;;OAIG;WACW,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,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AE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;CAIjD"}
@@ -1,4 +1,5 @@
1
1
  export { default as DefaultWeakMap } from './default-weak-map.js';
2
2
  export { default as DefaultMap } from './default-map.js';
3
3
  export { default as CacheDictionary } from './cache-dictionary.js';
4
+ export { default as from } from './from.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,WAAW,CAAC"}
@@ -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,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAQxC,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;IAOnC,aAAa,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAU7B,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACvD,CAAC;AAOF,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAK1D,KAAK,UAAU,GAAG;IAEd,MAAM,EAAE;QAAE,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IAEpE,WAAW,EAAE,WAAW,CAAC;CAC5B,CAAC;AAsDF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,CAAC,SAAS,MAAM,EAC1C,QAAQ,EAAE,CAAC,EACX,UAAU,CAAC,EAAE,UAAU,GACxB,KAAK,CAAC,CAAC,CAAC,CA6IV"}
1
+ {"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/draft.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,KAAK,YAAY,CAAC,CAAC,IAAI;IACnB;;;;;;;;OAQG;IACH,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAEtC;;;;;;;;OAQG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAExC;;;;;OAKG;IACH,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;IAEnC;;;;OAIG;IACH,aAAa,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAE7B;;;;;;;OAOG;IACH,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,15 @@ 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
+ export { default as Range } from './range.js';
17
18
  export { default as draft } from './draft.js';
18
19
  export { default as CleanURLSearchParams } from './clean-url-search-params.js';
20
+ /** @deprecated */
19
21
  export { ajaxSubmit, ajaxSubmission, submitForm, formToObject } from './browser/index.js';
22
+ /** @deprecated */
20
23
  export * from './array.js';
24
+ /** @deprecated */
21
25
  export * from './collections/index.js';
22
26
  //# 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,CAAC;AAC1C,OAAO,EAAC,OAAO,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,EAAE,IAAI,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,YAAY,CAAC;AA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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"}