@axi-engine/utils 0.1.7 → 0.1.8
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.
- package/README.md +1 -4
- package/dist/index.cjs +380 -0
- package/dist/{index.d.ts → index.d.cts} +84 -72
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +84 -72
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +295 -172
- package/dist/index.mjs.map +1 -0
- package/package.json +38 -33
- package/dist/index.js +0 -285
package/dist/index.mjs
CHANGED
|
@@ -1,232 +1,355 @@
|
|
|
1
|
-
|
|
1
|
+
import { v4 } from "uuid";
|
|
2
|
+
|
|
3
|
+
//#region src/arrays.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generates an array of numbers from 0 to length-1.
|
|
6
|
+
* @param length The desired length of the array.
|
|
7
|
+
* @returns An array of sequential numbers.
|
|
8
|
+
* @example genArray(3); // returns [0, 1, 2]
|
|
9
|
+
*/
|
|
2
10
|
function genArray(length) {
|
|
3
|
-
|
|
11
|
+
return Array.from({ length }, (_v, i) => i);
|
|
4
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new array with its elements shuffled in a random order.
|
|
15
|
+
* This function does not mutate the original array.
|
|
16
|
+
* @template T The type of elements in the array.
|
|
17
|
+
* @param array The array to shuffle.
|
|
18
|
+
* @returns A new, shuffled array.
|
|
19
|
+
*/
|
|
5
20
|
function shuffleArray(array) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
const result = [...array];
|
|
22
|
+
for (let i = result.length - 1; i > 0; i--) {
|
|
23
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
24
|
+
[result[i], result[j]] = [result[j], result[i]];
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
12
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Checks if the first array is a sequential starting subset of the second array.
|
|
30
|
+
* @param arr1 The potential subset array.
|
|
31
|
+
* @param arr2 The array to check against.
|
|
32
|
+
* @returns `true` if arr1 is a sequential start of arr2, otherwise `false`.
|
|
33
|
+
* @example
|
|
34
|
+
* isSequentialStart([1, 2], [1, 2, 3]); // true
|
|
35
|
+
* isSequentialStart([1, 3], [1, 2, 3]); // false
|
|
36
|
+
*/
|
|
13
37
|
function isSequentialStart(arr1, arr2) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
return arr1.every((element, index) => element === arr2[index]);
|
|
38
|
+
if (arr1.length > arr2.length) return false;
|
|
39
|
+
return arr1.every((element, index) => element === arr2[index]);
|
|
18
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Checks if two arrays contain the same elements, ignoring order.
|
|
43
|
+
* Works for arrays of primitives like strings or numbers.
|
|
44
|
+
* @template T The type of elements in the array.
|
|
45
|
+
* @param arr1 The first array.
|
|
46
|
+
* @param arr2 The second array.
|
|
47
|
+
* @returns `true` if both arrays contain the same elements, otherwise `false`.
|
|
48
|
+
* @example
|
|
49
|
+
* haveSameElements(['a', 'b'], ['b', 'a']); // true
|
|
50
|
+
* haveSameElements([1, 2, 3], [3, 1, 2]); // true
|
|
51
|
+
* haveSameElements(['a', 'b'], ['a', 'c']); // false
|
|
52
|
+
*/
|
|
19
53
|
function haveSameElements(arr1, arr2) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
54
|
+
if (!arr1 && !arr2) return true;
|
|
55
|
+
if (!arr1 || !arr2) return false;
|
|
56
|
+
if (arr1.length !== arr2.length) return false;
|
|
57
|
+
const sortedArr1 = [...arr1].sort();
|
|
58
|
+
const sortedArr2 = [...arr2].sort();
|
|
59
|
+
return sortedArr1.every((value, index) => value === sortedArr2[index]);
|
|
26
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Checks if two arrays are strictly equal (same elements in the same order).
|
|
63
|
+
* @template T The type of elements in the array.
|
|
64
|
+
* @param arr1 The first array.
|
|
65
|
+
* @param arr2 The second array.
|
|
66
|
+
* @returns `true` if the arrays are strictly equal, otherwise `false`.
|
|
67
|
+
* @example
|
|
68
|
+
* areArraysEqual(['a', 'b'], ['a', 'b']); // true
|
|
69
|
+
* areArraysEqual(['a', 'b'], ['b', 'a']); // false
|
|
70
|
+
* areArraysEqual([1, 2], [1, 2, 3]); // false
|
|
71
|
+
*/
|
|
27
72
|
function areArraysEqual(arr1, arr2) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
73
|
+
if (!arr1 && !arr2) return true;
|
|
74
|
+
if (!arr1 || !arr2) return false;
|
|
75
|
+
if (arr1.length !== arr2.length) return false;
|
|
76
|
+
return arr1.every((value, index) => value === arr2[index]);
|
|
32
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Gets the last element of an array.
|
|
80
|
+
* @template T The type of elements in the array.
|
|
81
|
+
* @param array The array to query.
|
|
82
|
+
* @returns The last element of the array, or `undefined` if the array is empty.
|
|
83
|
+
*/
|
|
33
84
|
function last(array) {
|
|
34
|
-
|
|
85
|
+
return array[array.length - 1];
|
|
35
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Creates a duplicate-free version of an array.
|
|
89
|
+
* @template T The type of elements in the array.
|
|
90
|
+
* @param array The array to process.
|
|
91
|
+
* @returns A new array with only unique elements.
|
|
92
|
+
*/
|
|
36
93
|
function unique(array) {
|
|
37
|
-
|
|
94
|
+
return [...new Set(array)];
|
|
38
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Gets a random element from an array.
|
|
98
|
+
* @template T The type of elements in the array.
|
|
99
|
+
* @param array The array to choose from.
|
|
100
|
+
* @returns A random element from the array, or `undefined` if the array is empty.
|
|
101
|
+
*/
|
|
39
102
|
function getRandomElement(array) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
const index = Math.floor(Math.random() * array.length);
|
|
44
|
-
return array[index];
|
|
103
|
+
if (array.length === 0) return;
|
|
104
|
+
return array[Math.floor(Math.random() * array.length)];
|
|
45
105
|
}
|
|
46
106
|
|
|
47
|
-
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/guards.ts
|
|
48
109
|
function isNullOrUndefined(val) {
|
|
49
|
-
|
|
110
|
+
return val === void 0 || val === null;
|
|
50
111
|
}
|
|
51
112
|
function isUndefined(val) {
|
|
52
|
-
|
|
113
|
+
return typeof val === "undefined";
|
|
53
114
|
}
|
|
54
115
|
function isNumber(val) {
|
|
55
|
-
|
|
116
|
+
return typeof val === "number";
|
|
56
117
|
}
|
|
57
118
|
function isBoolean(val) {
|
|
58
|
-
|
|
119
|
+
return typeof val === "boolean";
|
|
59
120
|
}
|
|
60
121
|
function isString(val) {
|
|
61
|
-
|
|
122
|
+
return typeof val === "string";
|
|
62
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Type guard to check if a value is a string that ends with '%'.
|
|
126
|
+
* @param val The value to check.
|
|
127
|
+
* @returns `true` if the value is a percentage string.
|
|
128
|
+
*/
|
|
63
129
|
function isPercentageString(val) {
|
|
64
|
-
|
|
130
|
+
return typeof val === "string" && val.endsWith("%");
|
|
65
131
|
}
|
|
66
132
|
|
|
67
|
-
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/assertion.ts
|
|
135
|
+
/**
|
|
136
|
+
* Throws an error if the condition is true.
|
|
137
|
+
* @param conditionForThrow - If true, an error will be thrown.
|
|
138
|
+
* @param exceptionMessage - The message for the error.
|
|
139
|
+
* @throws {Error} if the value is true
|
|
140
|
+
*/
|
|
68
141
|
function throwIf(conditionForThrow, exceptionMessage) {
|
|
69
|
-
|
|
70
|
-
throw new Error(exceptionMessage);
|
|
71
|
-
}
|
|
142
|
+
if (conditionForThrow) throw new Error(exceptionMessage);
|
|
72
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Throws an error if the value is null, undefined, or an empty array.
|
|
146
|
+
*
|
|
147
|
+
* @template T The type of the value being checked.
|
|
148
|
+
* @param value The value to check.
|
|
149
|
+
* @param exceptionMessage The message for the error.
|
|
150
|
+
* @throws {Error} if the value is null, undefined, or an empty array.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* // Example with a potentially undefined variable
|
|
154
|
+
* const user: { name: string } | undefined = findUser();
|
|
155
|
+
* throwIfEmpty(user, 'User not found');
|
|
156
|
+
* // From here, TypeScript knows `user` is not undefined.
|
|
157
|
+
* console.log(user.name);
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* // Example with an array
|
|
161
|
+
* const items: string[] = getItems();
|
|
162
|
+
* throwIfEmpty(items, 'Items array cannot be empty');
|
|
163
|
+
* // From here, you can safely access items[0] without checking for an empty array again.
|
|
164
|
+
* console.log('First item:', items[0]);
|
|
165
|
+
*/
|
|
73
166
|
function throwIfEmpty(value, exceptionMessage) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
throw new Error(exceptionMessage);
|
|
77
|
-
}
|
|
167
|
+
const isArrayAndEmpty = Array.isArray(value) && value.length === 0;
|
|
168
|
+
if (isNullOrUndefined(value) || isArrayAndEmpty) throw new Error(exceptionMessage);
|
|
78
169
|
}
|
|
79
170
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/config.ts
|
|
173
|
+
const defaultConfig = { pathSeparator: "/" };
|
|
174
|
+
const axiSettings = { ...defaultConfig };
|
|
175
|
+
/**
|
|
176
|
+
* set up global configuration for axi-engine.
|
|
177
|
+
* @param newConfig - configuration object
|
|
178
|
+
*/
|
|
85
179
|
function configure(newConfig) {
|
|
86
|
-
|
|
180
|
+
Object.assign(axiSettings, newConfig);
|
|
87
181
|
}
|
|
88
182
|
|
|
89
|
-
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/constructor-registry.ts
|
|
185
|
+
/**
|
|
186
|
+
* A generic registry for mapping string identifiers to class constructors.
|
|
187
|
+
*
|
|
188
|
+
* This utility is fundamental for building extensible systems like dependency injection containers,
|
|
189
|
+
* factories, and serialization engines where types need to be dynamically resolved.
|
|
190
|
+
*
|
|
191
|
+
* @template T - A base type that all registered constructors must produce an instance of.
|
|
192
|
+
*/
|
|
90
193
|
var ConstructorRegistry = class {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
194
|
+
items = /* @__PURE__ */ new Map();
|
|
195
|
+
/**
|
|
196
|
+
* Registers a constructor with a unique string identifier.
|
|
197
|
+
*
|
|
198
|
+
* @param typeId - The unique identifier for the constructor (e.g., a static `typeName` property from a class).
|
|
199
|
+
* @param ctor - The class constructor to register.
|
|
200
|
+
* @returns The registry instance for chainable calls.
|
|
201
|
+
* @throws If a constructor with the same `typeId` is already registered.
|
|
202
|
+
*/
|
|
203
|
+
register(typeId, ctor) {
|
|
204
|
+
throwIf(this.items.has(typeId), `A constructor with typeId '${typeId}' is already registered.`);
|
|
205
|
+
this.items.set(typeId, ctor);
|
|
206
|
+
return this;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Retrieves a constructor by its identifier.
|
|
210
|
+
*
|
|
211
|
+
* @param typeId - The identifier of the constructor to retrieve.
|
|
212
|
+
* @returns The found class constructor.
|
|
213
|
+
* @throws If no constructor is found for the given `typeId`.
|
|
214
|
+
*/
|
|
215
|
+
get(typeId) {
|
|
216
|
+
const Ctor = this.items.get(typeId);
|
|
217
|
+
throwIfEmpty(Ctor, `No constructor found for typeId '${typeId}'`);
|
|
218
|
+
return Ctor;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Checks if a constructor for a given identifier is registered.
|
|
222
|
+
* @param typeId - The identifier to check.
|
|
223
|
+
* @returns `true` if a constructor is registered, otherwise `false`.
|
|
224
|
+
*/
|
|
225
|
+
has(typeId) {
|
|
226
|
+
return this.items.has(typeId);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Clears all registered constructors from the registry.
|
|
230
|
+
*/
|
|
231
|
+
clear() {
|
|
232
|
+
this.items.clear();
|
|
233
|
+
}
|
|
131
234
|
};
|
|
132
235
|
|
|
133
|
-
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/emitter.ts
|
|
238
|
+
/**
|
|
239
|
+
* A minimal, type-safe event emitter for a single event.
|
|
240
|
+
* It does not manage state, it only manages subscribers and event dispatching.
|
|
241
|
+
* @template T A tuple representing the types of the event arguments.
|
|
242
|
+
*/
|
|
134
243
|
var Emitter = class {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
244
|
+
listeners = /* @__PURE__ */ new Set();
|
|
245
|
+
/**
|
|
246
|
+
* Returns the number of listeners.
|
|
247
|
+
*/
|
|
248
|
+
get listenerCount() {
|
|
249
|
+
return this.listeners.size;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Subscribes a listener to this event.
|
|
253
|
+
* @returns A function to unsubscribe the listener.
|
|
254
|
+
*/
|
|
255
|
+
subscribe(listener) {
|
|
256
|
+
this.listeners.add(listener);
|
|
257
|
+
return () => this.listeners.delete(listener);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Manually unsubscribe by listener
|
|
261
|
+
* @returns returns true if an listener has been removed, or false if the listener does not exist.
|
|
262
|
+
*/
|
|
263
|
+
unsubscribe(listener) {
|
|
264
|
+
return this.listeners.delete(listener);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Dispatches the event to all subscribed listeners.
|
|
268
|
+
*/
|
|
269
|
+
emit(...args) {
|
|
270
|
+
this.listeners.forEach((listener) => listener(...args));
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Clears all listeners.
|
|
274
|
+
*/
|
|
275
|
+
clear() {
|
|
276
|
+
this.listeners.clear();
|
|
277
|
+
}
|
|
169
278
|
};
|
|
170
279
|
|
|
171
|
-
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/math.ts
|
|
282
|
+
/**
|
|
283
|
+
* Clamps a number between an optional minimum and maximum value.
|
|
284
|
+
* @param val The number to clamp.
|
|
285
|
+
* @param min The minimum value. If null or undefined, it's ignored.
|
|
286
|
+
* @param max The maximum value. If null or undefined, it's ignored.
|
|
287
|
+
* @returns The clamped number.
|
|
288
|
+
*/
|
|
172
289
|
function clampNumber(val, min, max) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
290
|
+
if (!isNullOrUndefined(min)) val = Math.max(val, min);
|
|
291
|
+
if (!isNullOrUndefined(max)) val = Math.min(val, max);
|
|
292
|
+
return val;
|
|
176
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Calculates a percentage of a given value.
|
|
296
|
+
* @param val The base value.
|
|
297
|
+
* @param percents The percentage to get.
|
|
298
|
+
* @returns The calculated percentage of the value.
|
|
299
|
+
* @example getPercentOf(200, 10); // returns 20
|
|
300
|
+
*/
|
|
177
301
|
function getPercentOf(val, percents) {
|
|
178
|
-
|
|
302
|
+
return percents / 100 * val;
|
|
179
303
|
}
|
|
180
304
|
|
|
181
|
-
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/misc.ts
|
|
307
|
+
/**
|
|
308
|
+
* Returns the first key of an object.
|
|
309
|
+
* @param obj The object from which to get the key.
|
|
310
|
+
* @returns The first key of the object as a string.
|
|
311
|
+
*/
|
|
182
312
|
function firstKeyOf(obj) {
|
|
183
|
-
|
|
313
|
+
return Object.keys(obj)[0];
|
|
184
314
|
}
|
|
185
315
|
|
|
186
|
-
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/path.ts
|
|
318
|
+
/**
|
|
319
|
+
* Ensures that the given path is returned as an array of segments.
|
|
320
|
+
*/
|
|
187
321
|
function ensurePathArray(path, separator = axiSettings.pathSeparator) {
|
|
188
|
-
|
|
322
|
+
return Array.isArray(path) ? [...path] : path.split(separator);
|
|
189
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* Ensures that the given path is returned as a single string.
|
|
326
|
+
*/
|
|
190
327
|
function ensurePathString(path, separator = axiSettings.pathSeparator) {
|
|
191
|
-
|
|
328
|
+
return !Array.isArray(path) ? path : path.join(separator);
|
|
192
329
|
}
|
|
193
330
|
|
|
194
|
-
|
|
195
|
-
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/random.ts
|
|
333
|
+
/**
|
|
334
|
+
* Returns a random integer between min (inclusive) and max (exclusive).
|
|
335
|
+
* @param min The minimum integer (inclusive).
|
|
336
|
+
* @param max The maximum integer (exclusive).
|
|
337
|
+
* @returns A random integer.
|
|
338
|
+
* @example randInt(1, 5); // returns 1, 2, 3, or 4
|
|
339
|
+
*/
|
|
196
340
|
function randInt(min, max) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
341
|
+
min = Math.ceil(min);
|
|
342
|
+
max = Math.floor(max);
|
|
343
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
200
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Generates a unique identifier using uuidv4.
|
|
347
|
+
* @returns A unique string ID.
|
|
348
|
+
*/
|
|
201
349
|
function randId() {
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
axiSettings,
|
|
209
|
-
clampNumber,
|
|
210
|
-
configure,
|
|
211
|
-
ensurePathArray,
|
|
212
|
-
ensurePathString,
|
|
213
|
-
firstKeyOf,
|
|
214
|
-
genArray,
|
|
215
|
-
getPercentOf,
|
|
216
|
-
getRandomElement,
|
|
217
|
-
haveSameElements,
|
|
218
|
-
isBoolean,
|
|
219
|
-
isNullOrUndefined,
|
|
220
|
-
isNumber,
|
|
221
|
-
isPercentageString,
|
|
222
|
-
isSequentialStart,
|
|
223
|
-
isString,
|
|
224
|
-
isUndefined,
|
|
225
|
-
last,
|
|
226
|
-
randId,
|
|
227
|
-
randInt,
|
|
228
|
-
shuffleArray,
|
|
229
|
-
throwIf,
|
|
230
|
-
throwIfEmpty,
|
|
231
|
-
unique
|
|
232
|
-
};
|
|
350
|
+
return v4();
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
//#endregion
|
|
354
|
+
export { ConstructorRegistry, Emitter, areArraysEqual, axiSettings, clampNumber, configure, ensurePathArray, ensurePathString, firstKeyOf, genArray, getPercentOf, getRandomElement, haveSameElements, isBoolean, isNullOrUndefined, isNumber, isPercentageString, isSequentialStart, isString, isUndefined, last, randId, randInt, shuffleArray, throwIf, throwIfEmpty, unique };
|
|
355
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["uuidv4"],"sources":["../src/arrays.ts","../src/guards.ts","../src/assertion.ts","../src/config.ts","../src/constructor-registry.ts","../src/emitter.ts","../src/math.ts","../src/misc.ts","../src/path.ts","../src/random.ts"],"sourcesContent":["/**\r\n * Generates an array of numbers from 0 to length-1.\r\n * @param length The desired length of the array.\r\n * @returns An array of sequential numbers.\r\n * @example genArray(3); // returns [0, 1, 2]\r\n */\r\nexport function genArray(length: number) {\r\n return Array.from({length}, (_v, i) => i);\r\n}\r\n\r\n/**\r\n * Creates a new array with its elements shuffled in a random order.\r\n * This function does not mutate the original array.\r\n * @template T The type of elements in the array.\r\n * @param array The array to shuffle.\r\n * @returns A new, shuffled array.\r\n */\r\nexport function shuffleArray<T>(array: T[]): T[] {\r\n const result = [...array];\r\n for (let i = result.length - 1; i > 0; i--) {\r\n const j = Math.floor(Math.random() * (i + 1));\r\n [result[i], result[j]] = [result[j], result[i]];\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Checks if the first array is a sequential starting subset of the second array.\r\n * @param arr1 The potential subset array.\r\n * @param arr2 The array to check against.\r\n * @returns `true` if arr1 is a sequential start of arr2, otherwise `false`.\r\n * @example\r\n * isSequentialStart([1, 2], [1, 2, 3]); // true\r\n * isSequentialStart([1, 3], [1, 2, 3]); // false\r\n */\r\nexport function isSequentialStart<T>(arr1: T[], arr2: T[]): boolean {\r\n if (arr1.length > arr2.length) {\r\n return false;\r\n }\r\n return arr1.every((element, index) => element === arr2[index]);\r\n}\r\n\r\n/**\r\n * Checks if two arrays contain the same elements, ignoring order.\r\n * Works for arrays of primitives like strings or numbers.\r\n * @template T The type of elements in the array.\r\n * @param arr1 The first array.\r\n * @param arr2 The second array.\r\n * @returns `true` if both arrays contain the same elements, otherwise `false`.\r\n * @example\r\n * haveSameElements(['a', 'b'], ['b', 'a']); // true\r\n * haveSameElements([1, 2, 3], [3, 1, 2]); // true\r\n * haveSameElements(['a', 'b'], ['a', 'c']); // false\r\n */\r\nexport function haveSameElements<T>(arr1?: T[], arr2?: T[]): boolean {\r\n if (!arr1 && !arr2) return true;\r\n if (!arr1 || !arr2) return false;\r\n if (arr1.length !== arr2.length) return false;\r\n\r\n // Create sorted copies to compare\r\n const sortedArr1 = [...arr1].sort();\r\n const sortedArr2 = [...arr2].sort();\r\n\r\n return sortedArr1.every((value, index) => value === sortedArr2[index]);\r\n}\r\n\r\n/**\r\n * Checks if two arrays are strictly equal (same elements in the same order).\r\n * @template T The type of elements in the array.\r\n * @param arr1 The first array.\r\n * @param arr2 The second array.\r\n * @returns `true` if the arrays are strictly equal, otherwise `false`.\r\n * @example\r\n * areArraysEqual(['a', 'b'], ['a', 'b']); // true\r\n * areArraysEqual(['a', 'b'], ['b', 'a']); // false\r\n * areArraysEqual([1, 2], [1, 2, 3]); // false\r\n */\r\nexport function areArraysEqual<T>(arr1?: T[], arr2?: T[]): boolean {\r\n if (!arr1 && !arr2) return true;\r\n if (!arr1 || !arr2) return false;\r\n if (arr1.length !== arr2.length) return false;\r\n\r\n return arr1.every((value, index) => value === arr2[index]);\r\n}\r\n\r\n/**\r\n * Gets the last element of an array.\r\n * @template T The type of elements in the array.\r\n * @param array The array to query.\r\n * @returns The last element of the array, or `undefined` if the array is empty.\r\n */\r\nexport function last<T>(array: T[]): T | undefined {\r\n return array[array.length - 1];\r\n}\r\n\r\n/**\r\n * Creates a duplicate-free version of an array.\r\n * @template T The type of elements in the array.\r\n * @param array The array to process.\r\n * @returns A new array with only unique elements.\r\n */\r\nexport function unique<T>(array: T[]): T[] {\r\n return [...new Set(array)];\r\n}\r\n\r\n/**\r\n * Gets a random element from an array.\r\n * @template T The type of elements in the array.\r\n * @param array The array to choose from.\r\n * @returns A random element from the array, or `undefined` if the array is empty.\r\n */\r\nexport function getRandomElement<T>(array: T[]): T | undefined {\r\n if (array.length === 0) {\r\n return undefined;\r\n }\r\n const index = Math.floor(Math.random() * array.length);\r\n return array[index];\r\n}\r\n","export function isNullOrUndefined(val: unknown): val is null | undefined {\r\n return val === undefined || val === null;\r\n}\r\n\r\nexport function isUndefined(val: unknown): val is undefined {\r\n return typeof val === 'undefined';\r\n}\r\n\r\nexport function isNumber(val: unknown): val is number {\r\n return typeof val === \"number\";\r\n}\r\n\r\nexport function isBoolean(val: unknown): val is boolean {\r\n return typeof val === \"boolean\";\r\n}\r\n\r\nexport function isString(val: unknown): val is string {\r\n return typeof val === \"string\";\r\n}\r\n\r\n/**\r\n * Type guard to check if a value is a string that ends with '%'.\r\n * @param val The value to check.\r\n * @returns `true` if the value is a percentage string.\r\n */\r\nexport function isPercentageString(val: unknown): val is string {\r\n return typeof val === \"string\" && val.endsWith(\"%\");\r\n}\r\n","import {isNullOrUndefined} from './guards';\r\n\r\n/**\r\n * Throws an error if the condition is true.\r\n * @param conditionForThrow - If true, an error will be thrown.\r\n * @param exceptionMessage - The message for the error.\r\n * @throws {Error} if the value is true\r\n */\r\nexport function throwIf(conditionForThrow: boolean, exceptionMessage: string): void | never {\r\n if (conditionForThrow) {\r\n throw new Error(exceptionMessage);\r\n }\r\n}\r\n\r\n/**\r\n * Throws an error if the value is null, undefined, or an empty array.\r\n *\r\n * @template T The type of the value being checked.\r\n * @param value The value to check.\r\n * @param exceptionMessage The message for the error.\r\n * @throws {Error} if the value is null, undefined, or an empty array.\r\n *\r\n * @example\r\n * // Example with a potentially undefined variable\r\n * const user: { name: string } | undefined = findUser();\r\n * throwIfEmpty(user, 'User not found');\r\n * // From here, TypeScript knows `user` is not undefined.\r\n * console.log(user.name);\r\n *\r\n * @example\r\n * // Example with an array\r\n * const items: string[] = getItems();\r\n * throwIfEmpty(items, 'Items array cannot be empty');\r\n * // From here, you can safely access items[0] without checking for an empty array again.\r\n * console.log('First item:', items[0]);\r\n */\r\nexport function throwIfEmpty<T>(\r\n value: T,\r\n exceptionMessage: string\r\n): asserts value is NonNullable<T> {\r\n const isArrayAndEmpty = Array.isArray(value) && value.length === 0;\r\n\r\n if (isNullOrUndefined(value) || isArrayAndEmpty) {\r\n throw new Error(exceptionMessage);\r\n }\r\n}\r\n","export interface AxiEngineConfig {\r\n pathSeparator: string;\r\n\r\n /** logging and debugging logic in future */\r\n // logLevel: 'debug' | 'info' | 'warn' | 'error';\r\n // defaultLocale: string;\r\n}\r\n\r\nconst defaultConfig: AxiEngineConfig = {\r\n pathSeparator: '/'\r\n};\r\n\r\nexport const axiSettings: AxiEngineConfig = { ...defaultConfig };\r\n\r\n/**\r\n * set up global configuration for axi-engine.\r\n * @param newConfig - configuration object\r\n */\r\nexport function configure(newConfig: Partial<AxiEngineConfig>): void {\r\n Object.assign(axiSettings, newConfig);\r\n}\r\n","import {Constructor, throwIf, throwIfEmpty} from '@axi-engine/utils';\r\n\r\n/**\r\n * A generic registry for mapping string identifiers to class constructors.\r\n *\r\n * This utility is fundamental for building extensible systems like dependency injection containers,\r\n * factories, and serialization engines where types need to be dynamically resolved.\r\n *\r\n * @template T - A base type that all registered constructors must produce an instance of.\r\n */\r\nexport class ConstructorRegistry<T> {\r\n private readonly items = new Map<string, Constructor<T>>();\r\n\r\n /**\r\n * Registers a constructor with a unique string identifier.\r\n *\r\n * @param typeId - The unique identifier for the constructor (e.g., a static `typeName` property from a class).\r\n * @param ctor - The class constructor to register.\r\n * @returns The registry instance for chainable calls.\r\n * @throws If a constructor with the same `typeId` is already registered.\r\n */\r\n register(typeId: string, ctor: Constructor<T>): this {\r\n throwIf(this.items.has(typeId), `A constructor with typeId '${typeId}' is already registered.`);\r\n this.items.set(typeId, ctor);\r\n return this;\r\n }\r\n\r\n /**\r\n * Retrieves a constructor by its identifier.\r\n *\r\n * @param typeId - The identifier of the constructor to retrieve.\r\n * @returns The found class constructor.\r\n * @throws If no constructor is found for the given `typeId`.\r\n */\r\n get(typeId: string): Constructor<T> {\r\n const Ctor = this.items.get(typeId);\r\n throwIfEmpty(Ctor, `No constructor found for typeId '${typeId}'`);\r\n return Ctor!;\r\n }\r\n\r\n /**\r\n * Checks if a constructor for a given identifier is registered.\r\n * @param typeId - The identifier to check.\r\n * @returns `true` if a constructor is registered, otherwise `false`.\r\n */\r\n has(typeId: string): boolean {\r\n return this.items.has(typeId);\r\n }\r\n\r\n /**\r\n * Clears all registered constructors from the registry.\r\n */\r\n clear(): void {\r\n this.items.clear();\r\n }\r\n}\r\n","// file: packages/utils/src/emitter.ts\r\n\r\nimport {Subscribable} from './types';\r\n\r\n/**\r\n * A minimal, type-safe event emitter for a single event.\r\n * It does not manage state, it only manages subscribers and event dispatching.\r\n * @template T A tuple representing the types of the event arguments.\r\n */\r\nexport class Emitter<T extends any[]> implements Subscribable<T>{\r\n private listeners: Set<(...args: T) => void> = new Set();\r\n\r\n /**\r\n * Returns the number of listeners.\r\n */\r\n get listenerCount(): number {\r\n return this.listeners.size;\r\n }\r\n\r\n /**\r\n * Subscribes a listener to this event.\r\n * @returns A function to unsubscribe the listener.\r\n */\r\n subscribe(listener: (...args: T) => void): () => void {\r\n this.listeners.add(listener);\r\n return () => this.listeners.delete(listener);\r\n }\r\n\r\n /**\r\n * Manually unsubscribe by listener\r\n * @returns returns true if an listener has been removed, or false if the listener does not exist.\r\n */\r\n unsubscribe(listener: (...args: T) => void) {\r\n return this.listeners.delete(listener);\r\n }\r\n\r\n /**\r\n * Dispatches the event to all subscribed listeners.\r\n */\r\n emit(...args: T): void {\r\n this.listeners.forEach(listener => listener(...args));\r\n }\r\n\r\n /**\r\n * Clears all listeners.\r\n */\r\n clear(): void {\r\n this.listeners.clear();\r\n }\r\n}\r\n","import {isNullOrUndefined} from './guards';\r\n\r\n\r\n/**\r\n * Clamps a number between an optional minimum and maximum value.\r\n * @param val The number to clamp.\r\n * @param min The minimum value. If null or undefined, it's ignored.\r\n * @param max The maximum value. If null or undefined, it's ignored.\r\n * @returns The clamped number.\r\n */\r\nexport function clampNumber(val: number, min?: number | null, max?: number | null): number {\r\n if (!isNullOrUndefined(min)) val = Math.max(val, min);\r\n if (!isNullOrUndefined(max)) val = Math.min(val, max);\r\n return val;\r\n}\r\n\r\n/**\r\n * Calculates a percentage of a given value.\r\n * @param val The base value.\r\n * @param percents The percentage to get.\r\n * @returns The calculated percentage of the value.\r\n * @example getPercentOf(200, 10); // returns 20\r\n */\r\nexport function getPercentOf(val: number, percents: number) {\r\n return (percents / 100) * val;\r\n}\r\n","/**\r\n * Returns the first key of an object.\r\n * @param obj The object from which to get the key.\r\n * @returns The first key of the object as a string.\r\n */\r\nexport function firstKeyOf(obj: any) {\r\n return Object.keys(obj)[0];\r\n}\r\n","import {PathType} from \"./types\";\r\nimport {axiSettings} from './config';\r\n\r\n/**\r\n * Ensures that the given path is returned as an array of segments.\r\n */\r\nexport function ensurePathArray(path: PathType, separator = axiSettings.pathSeparator): string[] {\r\n return Array.isArray(path) ? [...path] : path.split(separator);\r\n}\r\n\r\n/**\r\n * Ensures that the given path is returned as a single string.\r\n */\r\nexport function ensurePathString(path: PathType, separator = axiSettings.pathSeparator): string {\r\n return !Array.isArray(path) ? path : path.join(separator);\r\n}\r\n","import { v4 as uuidv4 } from 'uuid';\r\n\r\n/**\r\n * Returns a random integer between min (inclusive) and max (exclusive).\r\n * @param min The minimum integer (inclusive).\r\n * @param max The maximum integer (exclusive).\r\n * @returns A random integer.\r\n * @example randInt(1, 5); // returns 1, 2, 3, or 4\r\n */\r\nexport function randInt(min: number, max: number): number {\r\n min = Math.ceil(min);\r\n max = Math.floor(max);\r\n return Math.floor(Math.random() * (max - min) + min);\r\n}\r\n\r\n/**\r\n * Generates a unique identifier using uuidv4.\r\n * @returns A unique string ID.\r\n */\r\nexport function randId() {\r\n return uuidv4();\r\n}\r\n"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@axi-engine/utils",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Core utility library for Axi Engine, providing common functions for arrays, math, type guards, and more.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@axi-engine/utils",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"description": "Core utility library for Axi Engine, providing common functions for arrays, math, type guards, and more.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/axijs/engine.git",
|
|
9
|
+
"directory": "packages/utils"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"axi-engine",
|
|
13
|
+
"typescript",
|
|
14
|
+
"gamedev",
|
|
15
|
+
"utils"
|
|
16
|
+
],
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"module": "./dist/index.mjs",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsdown src/index.ts --format cjs,esm --dts --clean",
|
|
29
|
+
"docs": "typedoc src/index.ts --out docs/api --options ../../typedoc.json",
|
|
30
|
+
"test": "echo 'No tests yet for @axi-engine/utils'"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"uuid": "^13.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|