@dayme/alien-utils 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterator.d.ts","sourceRoot":"","sources":["../../src/package/iterator/iterator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAwB/C;;GAEG;AACH,KAAK,MAAM,GACP,KAAK,GACL,QAAQ,GACR,SAAS,GACT,SAAS,GACT,MAAM,GACN,WAAW,GACX,MAAM,GACN,WAAW,GACX,WAAW,GACX,KAAK,GACL,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,UAAU,CAAC;AAEf;;GAEG;AACH,UAAU,EAAE;IACV,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,IAAI,CAAC,CAAC,CAAE,YAAW,QAAQ,CAAC,CAAC,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAO;IAE3B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;OAKG;gBACS,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,GAAE,EAAE,EAAO,EAAE,OAAO,GAAE,MAAU;IAMpE;;OAEG;IACH,OAAO,KAAK,OAAO,GAElB;IAED;;OAEG;IACH,OAAO,KAAK,YAAY,GAYvB;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAI9C;;;;;;;;;;;;;OAaG;IACH,M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,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAIjD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAY1C;;;;;;;;;;;;OAYG;IACH,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC;CAGnB"}
@@ -0,0 +1,2 @@
1
+ export { match, type Matcher } from './match';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package/match/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A Rust-like pattern matching function
3
+ * Usage:
4
+ * const matcher = match({
5
+ * 1: v => v,
6
+ * 2: v => v * 2,
7
+ * _: v => v * 3 // default case
8
+ * });
9
+ *
10
+ * matcher(5); // will use the default case and return 5 * 3 = 15
11
+ * matcher(1); // will use the 1 case and return 1
12
+ */
13
+ export type Matcher<T, R> = Record<string | number, (value: T) => R> & {
14
+ _: (value: T) => R;
15
+ };
16
+ export declare function match<T, R>(patterns: Matcher<T, R>): (value: T) => R;
17
+ //# sourceMappingURL=match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../src/package/match/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG;IAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAA;CAAE,CAAC;AAE9F,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAYpE"}
@@ -0,0 +1,3 @@
1
+ import { Some, None, Option } from './option';
2
+ export { Some, None, type Option };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package/option/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC"}
@@ -0,0 +1,274 @@
1
+ /**
2
+ * Option type represents a value that may be present (Some) or absent (None).
3
+ * This is an alternative to using null or undefined to represent missing values.
4
+ *
5
+ * @template T - Type of the value
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * function findUser(id: number): Option<User> {
10
+ * const user = users.find(u => u.id === id);
11
+ * return user ? new Some(user) : None.instance();
12
+ * }
13
+ * ```
14
+ */
15
+ export type Option<T> = Some<T> | None;
16
+ /**
17
+ * Interface for the Option type, defining all available methods.
18
+ *
19
+ * @template T - Type of the value
20
+ */
21
+ interface IOption<T> {
22
+ /**
23
+ * Checks if the Option is Some (contains a value).
24
+ *
25
+ * @returns true if the Option is Some, otherwise false
26
+ */
27
+ isSome(): this is Some<T>;
28
+ /**
29
+ * Checks if the Option is None (does not contain a value).
30
+ *
31
+ * @returns true if the Option is None, otherwise false
32
+ */
33
+ isNone(): this is None;
34
+ /**
35
+ * Extracts the value from Some. Throws an error if called on None.
36
+ *
37
+ * @throws {Error} If called on None
38
+ * @returns Value of type T
39
+ */
40
+ unwrap(): T;
41
+ /**
42
+ * Extracts the value from Some or returns the default value for None.
43
+ *
44
+ * @param defaultValue - Default value
45
+ * @returns Value of type T
46
+ */
47
+ unwrapOr(defaultValue: T): T;
48
+ /**
49
+ * Extracts the value from Some or computes a default value for None.
50
+ *
51
+ * @param fn - Function that returns a default value
52
+ * @returns Value of type T
53
+ */
54
+ unwrapOrElse(fn: () => T): T;
55
+ /**
56
+ * Applies a function to the Some value, leaving None unchanged.
57
+ *
58
+ * @template U - Type of the transformation result
59
+ * @param fn - Transformation function
60
+ * @returns New Option with transformed value
61
+ */
62
+ map<U>(fn: (value: T) => U): Option<U>;
63
+ /**
64
+ * Applies a function that returns an Option to the Some value.
65
+ * If the Option is Some, applies the function; if None, returns None unchanged.
66
+ *
67
+ * @template U - Type of the new Option value
68
+ * @param fn - Function that takes a value and returns an Option
69
+ * @returns New Option
70
+ */
71
+ andThen<U>(fn: (value: T) => Option<U>): Option<U>;
72
+ /**
73
+ * Matches the Option with handlers for Some and None.
74
+ *
75
+ * @template U - Type of the return value
76
+ * @param handlers - Object with handlers for Some and None
77
+ * @returns Result of the handling
78
+ */
79
+ match<U>(handlers: {
80
+ Some(value: T): U;
81
+ None: U;
82
+ }): U;
83
+ /**
84
+ * Returns Some if this is Some, otherwise returns another Option.
85
+ *
86
+ * @param other - Alternative Option
87
+ * @returns Some if this is Some, otherwise other
88
+ */
89
+ or(other: Option<T>): Option<T>;
90
+ /**
91
+ * Returns Some if this is Some, otherwise calls a function to get an alternative Option.
92
+ *
93
+ * @param fn - Function that returns an Option
94
+ * @returns Some if this is Some, otherwise the result of the function
95
+ */
96
+ orElse(fn: () => Option<T>): Option<T>;
97
+ /**
98
+ * Filters the Some value by a predicate. Returns None if the predicate returns false.
99
+ *
100
+ * @param predicate - Predicate function to test the value
101
+ * @returns Some if the predicate returns true, otherwise None
102
+ */
103
+ filter(predicate: (value: T) => boolean): Option<T>;
104
+ }
105
+ /**
106
+ * Class representing an Option with a present value.
107
+ *
108
+ * @template T - Type of the value
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const option = new Some(42);
113
+ * if (option.isSome()) {
114
+ * console.log(option.value); // 42
115
+ * }
116
+ * ```
117
+ */
118
+ export declare class Some<T> implements IOption<T> {
119
+ readonly value: T;
120
+ readonly _tag: "Some";
121
+ /**
122
+ * Creates a new Some instance with the specified value.
123
+ *
124
+ * @param value - Value
125
+ */
126
+ constructor(value: T);
127
+ /**
128
+ * Static constructor for creating Some.
129
+ *
130
+ * @template T - Type of the value
131
+ * @param value - Value
132
+ * @returns New Some instance
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * const option = Some.of(42);
137
+ * ```
138
+ */
139
+ static of<T>(value: T): Some<T>;
140
+ /**
141
+ * Collects an array of Options into a single Option with an array of values.
142
+ * If at least one Option is None, returns None.
143
+ *
144
+ * @template T - Type of the values
145
+ * @param options - Array of Options to collect
146
+ * @returns Option with array of values or None
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * const options = [Some.of(1), Some.of(2), Some.of(3)];
151
+ * const collected = Some.collect(options); // Some([1, 2, 3])
152
+ * ```
153
+ */
154
+ static collect<T>(options: Option<T>[]): Option<T[]>;
155
+ /**
156
+ * Partitions an array of Options into two arrays: one with Some, another with None.
157
+ *
158
+ * @template T - Type of the values
159
+ * @param options - Array of Options to partition
160
+ * @returns Tuple of two arrays: [Some[], None[]]
161
+ *
162
+ * @example
163
+ * ```ts
164
+ * const options = [Some.of(1), None.instance(), Some.of(3)];
165
+ * const [somes, nones] = Some.partition(options);
166
+ * // somes: [Some(1), Some(3)]
167
+ * // nones: [None, None]
168
+ * ```
169
+ */
170
+ static partition<T>(options: Option<T>[]): [Some<T>[], None[]];
171
+ isSome(): this is Some<T>;
172
+ isNone(): this is None;
173
+ unwrap(): T;
174
+ unwrapOr(_defaultValue: T): T;
175
+ unwrapOrElse(_fn: (value: T) => T): T;
176
+ map<U>(fn: (value: T) => U): Option<U>;
177
+ andThen<U>(fn: (value: T) => Option<U>): Option<U>;
178
+ match<U>(handlers: {
179
+ Some(value: T): U;
180
+ None: U;
181
+ }): U;
182
+ or(_other: Option<T>): Option<T>;
183
+ orElse(_fn: () => Option<T>): Option<T>;
184
+ filter(predicate: (value: T) => boolean): Option<T>;
185
+ /**
186
+ * Returns a string representation of Some.
187
+ *
188
+ * @returns String in the format "Some(value)"
189
+ */
190
+ toString(): string;
191
+ /**
192
+ * Converts Some to a JSON-compatible object.
193
+ *
194
+ * @returns Object with fields some: true and value
195
+ */
196
+ toJSON(): {
197
+ some: boolean;
198
+ value: T;
199
+ };
200
+ }
201
+ /**
202
+ * Class representing an Option without a value (missing value).
203
+ * Implemented as a singleton for memory optimization.
204
+ *
205
+ * @example
206
+ * ```ts
207
+ * const option = None.instance();
208
+ * if (option.isNone()) {
209
+ * console.log("Value is missing");
210
+ * }
211
+ * ```
212
+ */
213
+ export declare class None implements IOption<never> {
214
+ readonly _tag: "None";
215
+ private static _instance;
216
+ /**
217
+ * Private constructor for implementing the singleton pattern.
218
+ */
219
+ private constructor();
220
+ /**
221
+ * Returns the single None instance (singleton).
222
+ *
223
+ * @returns None instance
224
+ *
225
+ * @example
226
+ * ```ts
227
+ * const none1 = None.instance();
228
+ * const none2 = None.instance();
229
+ * console.log(none1 === none2); // true
230
+ * ```
231
+ */
232
+ static instance(): None;
233
+ /**
234
+ * Static constructor for creating None (returns singleton).
235
+ *
236
+ * @returns None instance
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * const option = None.of();
241
+ * ```
242
+ */
243
+ static of(): None;
244
+ isSome(): this is Some<never>;
245
+ isNone(): this is None;
246
+ unwrap(): never;
247
+ unwrapOr<T>(defaultValue: T): T;
248
+ unwrapOrElse<T>(fn: () => T): T;
249
+ andThen<U>(_fn: (value: never) => Option<U>): None;
250
+ map<U>(_fn: (value: never) => U): None;
251
+ match<U>(handlers: {
252
+ Some(value: never): U;
253
+ None: U;
254
+ }): U;
255
+ or<T>(other: Option<T>): Option<T>;
256
+ orElse<T>(fn: () => Option<T>): Option<T>;
257
+ filter(_predicate: (value: never) => boolean): None;
258
+ /**
259
+ * Returns a string representation of None.
260
+ *
261
+ * @returns String "None"
262
+ */
263
+ toString(): string;
264
+ /**
265
+ * Converts None to a JSON-compatible object.
266
+ *
267
+ * @returns Object with field none: true
268
+ */
269
+ toJSON(): {
270
+ none: boolean;
271
+ };
272
+ }
273
+ export {};
274
+ //# sourceMappingURL=option.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../../src/package/option/option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAEvC;;;;GAIG;AACH,UAAU,OAAO,CAAC,CAAC;IACjB;;;;OAIG;IACH,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IAE1B;;;;OAIG;IACH,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC;IAEvB;;;;;OAKG;IACH,MAAM,IAAI,CAAC,CAAC;IAEZ;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC;IAE7B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAE7B;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAEvC;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAEnD;;;;;;OAMG;IACH,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE;QAAE,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAE,GAAG,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,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GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAIlD,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,GAAG,IAAI;IAItC,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE;QAAE,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAE,GAAG,CAAC;IAIzD,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAIlC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAIzC,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI;IAInD;;;;OAIG;IACH,QAAQ;IAIR;;;;OAIG;IACH,MAAM;;;CAGP"}
@@ -0,0 +1,2 @@
1
+ export { Queue } from './queue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package/queue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Option } from '../option/option';
2
+ export declare class Queue<T> implements Iterable<T> {
3
+ private buffer;
4
+ private head;
5
+ private tail;
6
+ private count;
7
+ constructor(initialCapacity?: number);
8
+ enqueue(value: T): void;
9
+ dequeue(): Option<T>;
10
+ peek(): Option<T>;
11
+ get size(): number;
12
+ isEmpty(): boolean;
13
+ clear(): void;
14
+ private resize;
15
+ [Symbol.iterator](): Iterator<T>;
16
+ static from<T>(iterable: Iterable<T>): Queue<T>;
17
+ }
18
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/package/queue/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG/C,qBAAa,KAAK,CAAC,CAAC,CAAE,YAAW,QAAQ,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,KAAK,CAAa;gBAEd,eAAe,GAAE,MAAW;IAOxC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IASvB,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC;IAWpB,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC;IAOjB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,IAAI,OAAO;IAIlB,KAAK,IAAI,IAAI;IAOb,OAAO,CAAC,MAAM;IAUd,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC;IAchC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;CAOhD"}
@@ -0,0 +1,3 @@
1
+ import { Ok, Err, Result } from './result';
2
+ export { Ok, Err, type Result };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package/result/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,MAAM,EAAE,CAAC"}