@dayme/alien-utils 0.1.0 → 0.3.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.
- package/README.md +121 -98
- package/dist/history/history.d.ts +83 -0
- package/dist/history/history.d.ts.map +1 -0
- package/dist/history/index.d.ts +3 -0
- package/dist/history/index.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +431 -1
- package/dist/iterator/index.d.ts +1 -0
- package/dist/iterator/index.d.ts.map +1 -1
- package/dist/iterator/iterator.d.ts.map +1 -1
- package/dist/iterator/par-iter.d.ts +135 -0
- package/dist/iterator/par-iter.d.ts.map +1 -0
- package/dist/iterator/par-worker.d.ts +2 -0
- package/dist/iterator/par-worker.d.ts.map +1 -0
- package/package.json +3 -6
package/README.md
CHANGED
|
@@ -1,98 +1,121 @@
|
|
|
1
|
-
# @dayme/alien-utils
|
|
2
|
-
|
|
3
|
-
TypeScript utility library with functional programming data structures (Option, Result, Iter, Stack, Queue, Bimap, Match, Dispatch).
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @dayme/alien-utils
|
|
9
|
-
# or
|
|
10
|
-
bun add @dayme/alien-utils
|
|
11
|
-
# or
|
|
12
|
-
pnpm add @dayme/alien-utils
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
import { Option, Result, Iter, Stack, Queue } from "@dayme/alien-utils";
|
|
19
|
-
|
|
20
|
-
// Option - Handle nullable values
|
|
21
|
-
const maybeValue = Option.from("hello");
|
|
22
|
-
const doubled = maybeValue.map(s => s.length * 2); // Some(10)
|
|
23
|
-
|
|
24
|
-
// Result - Handle errors
|
|
25
|
-
const result = Result.ok(42);
|
|
26
|
-
const value = result.unwrapOr(0); // 42
|
|
27
|
-
|
|
28
|
-
// Iter - Lazy transformations
|
|
29
|
-
Iter.from([1, 2, 3])
|
|
30
|
-
.map(x => x * 2)
|
|
31
|
-
.filter(x => x > 3)
|
|
32
|
-
.collect(); // [4, 6]
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
#
|
|
59
|
-
bun
|
|
60
|
-
|
|
61
|
-
#
|
|
62
|
-
bun
|
|
63
|
-
|
|
64
|
-
#
|
|
65
|
-
bun
|
|
66
|
-
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
#
|
|
76
|
-
bun run
|
|
77
|
-
|
|
78
|
-
#
|
|
79
|
-
bun run docs:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
1
|
+
# @dayme/alien-utils
|
|
2
|
+
|
|
3
|
+
TypeScript utility library with functional programming data structures (Option, Result, Iter, Stack, Queue, Bimap, Match, Dispatch).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @dayme/alien-utils
|
|
9
|
+
# or
|
|
10
|
+
bun add @dayme/alien-utils
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @dayme/alien-utils
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { Option, Result, Iter, ParIter, Stack, Queue } from "@dayme/alien-utils";
|
|
19
|
+
|
|
20
|
+
// Option - Handle nullable values
|
|
21
|
+
const maybeValue = Option.from("hello");
|
|
22
|
+
const doubled = maybeValue.map(s => s.length * 2); // Some(10)
|
|
23
|
+
|
|
24
|
+
// Result - Handle errors
|
|
25
|
+
const result = Result.ok(42);
|
|
26
|
+
const value = result.unwrapOr(0); // 42
|
|
27
|
+
|
|
28
|
+
// Iter - Lazy transformations
|
|
29
|
+
Iter.from([1, 2, 3])
|
|
30
|
+
.map(x => x * 2)
|
|
31
|
+
.filter(x => x > 3)
|
|
32
|
+
.collect(); // [4, 6]
|
|
33
|
+
|
|
34
|
+
// ParIter - Parallel processing for CPU-intensive operations
|
|
35
|
+
const result = await ParIter.from([1, 2, 3, 4, 5])
|
|
36
|
+
.map(x => x * 2) // Processed in parallel
|
|
37
|
+
.filter(x => x > 5)
|
|
38
|
+
.collect(); // [6, 8, 10]
|
|
39
|
+
|
|
40
|
+
// Stack - LIFO
|
|
41
|
+
const stack = new Stack<number>();
|
|
42
|
+
stack.push(1).push(2);
|
|
43
|
+
stack.pop(); // Some(2)
|
|
44
|
+
|
|
45
|
+
// Queue - FIFO
|
|
46
|
+
const queue = new Queue<number>();
|
|
47
|
+
queue.enqueue(1).enqueue(2);
|
|
48
|
+
queue.dequeue(); // Some(1)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
**[View Documentation](https://lisovskiyivan.github.io/alien-utils/)**
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Install dependencies
|
|
59
|
+
bun install
|
|
60
|
+
|
|
61
|
+
# Build library
|
|
62
|
+
bun run build
|
|
63
|
+
|
|
64
|
+
# Watch mode (TypeScript + Vite)
|
|
65
|
+
bun run dev
|
|
66
|
+
|
|
67
|
+
# Run tests
|
|
68
|
+
bun test
|
|
69
|
+
|
|
70
|
+
# Run tests in watch mode
|
|
71
|
+
bun test --watch
|
|
72
|
+
|
|
73
|
+
# Playground for testing the package
|
|
74
|
+
# First build the package: bun run build
|
|
75
|
+
# Then run playground: bun run playground
|
|
76
|
+
bun run playground
|
|
77
|
+
|
|
78
|
+
# Development documentation
|
|
79
|
+
bun run docs:dev
|
|
80
|
+
|
|
81
|
+
# Build documentation
|
|
82
|
+
bun run docs:build
|
|
83
|
+
|
|
84
|
+
# Preview documentation
|
|
85
|
+
bun run docs:preview
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Benchmarks
|
|
89
|
+
|
|
90
|
+
Performance and functionality benchmarks are located in the `benchmarks/` folder:
|
|
91
|
+
|
|
92
|
+
- `benchmark-par-iter.ts`: Performance comparison between Iter and ParIter
|
|
93
|
+
- `compare-functionality.ts`: Comprehensive functionality comparison
|
|
94
|
+
|
|
95
|
+
To run benchmarks:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Run performance benchmark
|
|
99
|
+
bun benchmarks/benchmark-par-iter.ts
|
|
100
|
+
|
|
101
|
+
# Run functionality comparison
|
|
102
|
+
bun benchmarks/compare-functionality.ts
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Testing
|
|
106
|
+
|
|
107
|
+
Tests are written using Bun's built-in test framework:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Run all tests
|
|
111
|
+
bun test
|
|
112
|
+
|
|
113
|
+
# Run tests in watch mode
|
|
114
|
+
bun test --watch
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Tests cover all methods of `Option` (Some/None), `Result` (Ok/Err), and other classes, including practical usage examples.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
MIT
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export interface HistoryOptions<T> {
|
|
2
|
+
limit?: number;
|
|
3
|
+
equals?: (a: T, b: T) => boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface Patch {
|
|
6
|
+
op: "add" | "remove" | "replace";
|
|
7
|
+
path: string;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
oldValue?: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface PatchHistoryOptions<T> {
|
|
12
|
+
limit?: number;
|
|
13
|
+
diff: (oldValue: T, newValue: T) => Patch[];
|
|
14
|
+
apply: (state: T, patches: Patch[]) => T;
|
|
15
|
+
invert: (patches: Patch[]) => Patch[];
|
|
16
|
+
}
|
|
17
|
+
type Subscriber<T> = (state: T) => void;
|
|
18
|
+
type TransactionFn = () => void;
|
|
19
|
+
export declare class History<T> {
|
|
20
|
+
private states;
|
|
21
|
+
private currentIndex;
|
|
22
|
+
private limit;
|
|
23
|
+
private equals;
|
|
24
|
+
private subscribers;
|
|
25
|
+
private inTransaction;
|
|
26
|
+
private transactionQueue;
|
|
27
|
+
private transactionStates;
|
|
28
|
+
constructor(initial: T, options?: HistoryOptions<T>);
|
|
29
|
+
get state(): T;
|
|
30
|
+
get index(): number;
|
|
31
|
+
get length(): number;
|
|
32
|
+
set(next: T): void;
|
|
33
|
+
private _addToHistory;
|
|
34
|
+
private _set;
|
|
35
|
+
update(draft: (state: T) => T): void;
|
|
36
|
+
private _update;
|
|
37
|
+
undo(): void;
|
|
38
|
+
private _undo;
|
|
39
|
+
redo(): void;
|
|
40
|
+
private _redo;
|
|
41
|
+
get canUndo(): boolean;
|
|
42
|
+
get canRedo(): boolean;
|
|
43
|
+
subscribe(subscriber: Subscriber<T>): () => void;
|
|
44
|
+
private _notify;
|
|
45
|
+
transaction(fn: TransactionFn): void;
|
|
46
|
+
clear(): void;
|
|
47
|
+
static from<T>(iterable: Iterable<T>, options?: HistoryOptions<T>): History<T>;
|
|
48
|
+
static withPatches<T>(initial: T, options: PatchHistoryOptions<T>): PatchHistory<T>;
|
|
49
|
+
}
|
|
50
|
+
export declare class PatchHistory<T> {
|
|
51
|
+
private currentState;
|
|
52
|
+
private patches;
|
|
53
|
+
private currentIndex;
|
|
54
|
+
private limit;
|
|
55
|
+
private diff;
|
|
56
|
+
private apply;
|
|
57
|
+
private invert;
|
|
58
|
+
private subscribers;
|
|
59
|
+
private inTransaction;
|
|
60
|
+
private transactionQueue;
|
|
61
|
+
private transactionStates;
|
|
62
|
+
constructor(initial: T, options: PatchHistoryOptions<T>);
|
|
63
|
+
get state(): T;
|
|
64
|
+
get index(): number;
|
|
65
|
+
get length(): number;
|
|
66
|
+
set(next: T): void;
|
|
67
|
+
private _addToHistory;
|
|
68
|
+
private _set;
|
|
69
|
+
update(draft: (state: T) => T): void;
|
|
70
|
+
private _update;
|
|
71
|
+
undo(): void;
|
|
72
|
+
private _undo;
|
|
73
|
+
redo(): void;
|
|
74
|
+
private _redo;
|
|
75
|
+
get canUndo(): boolean;
|
|
76
|
+
get canRedo(): boolean;
|
|
77
|
+
subscribe(subscriber: Subscriber<T>): () => void;
|
|
78
|
+
private _notify;
|
|
79
|
+
transaction(fn: TransactionFn): void;
|
|
80
|
+
clear(): void;
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/package/history/history.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MA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K,CAAC,GAAG,IAAI;IAQpC,OAAO,CAAC,OAAO;IAKf,IAAI,IAAI,IAAI;IAQZ,OAAO,CAAC,KAAK;IASb,IAAI,IAAI,IAAI;IAQZ,OAAO,CAAC,KAAK;IASb,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAOhD,OAAO,CAAC,OAAO;IAMf,WAAW,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI;IA6BpC,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package/history/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/package/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/package/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -867,6 +867,199 @@ var Some = class e {
|
|
|
867
867
|
reverse() {
|
|
868
868
|
return new n(this.collect().reverse());
|
|
869
869
|
}
|
|
870
|
+
}, ParIter = class e {
|
|
871
|
+
source;
|
|
872
|
+
ops;
|
|
873
|
+
config;
|
|
874
|
+
opsMask;
|
|
875
|
+
constructor(e, t = [], n = {}) {
|
|
876
|
+
this.source = e, this.ops = t, this.config = {
|
|
877
|
+
workers: n.workers || navigator.hardwareConcurrency || 4,
|
|
878
|
+
chunkSize: n.chunkSize || 1e4,
|
|
879
|
+
strategy: n.strategy || "static",
|
|
880
|
+
ordered: n.ordered ?? !1,
|
|
881
|
+
allowSideEffects: n.allowSideEffects ?? !1
|
|
882
|
+
};
|
|
883
|
+
let r = 0;
|
|
884
|
+
for (let e of t) switch (e.type) {
|
|
885
|
+
case "map":
|
|
886
|
+
r |= 1;
|
|
887
|
+
break;
|
|
888
|
+
case "filter":
|
|
889
|
+
r |= 2;
|
|
890
|
+
break;
|
|
891
|
+
case "reduce":
|
|
892
|
+
r |= 4;
|
|
893
|
+
break;
|
|
894
|
+
case "sum":
|
|
895
|
+
r |= 8;
|
|
896
|
+
break;
|
|
897
|
+
case "count":
|
|
898
|
+
r |= 16;
|
|
899
|
+
break;
|
|
900
|
+
case "groupBy":
|
|
901
|
+
r |= 32;
|
|
902
|
+
break;
|
|
903
|
+
}
|
|
904
|
+
this.opsMask = r;
|
|
905
|
+
}
|
|
906
|
+
static from(t, n = {}) {
|
|
907
|
+
return new e(t, [], n);
|
|
908
|
+
}
|
|
909
|
+
static create(t, n = {}) {
|
|
910
|
+
return new e(t, [], {
|
|
911
|
+
workers: n.workers || navigator.hardwareConcurrency || 4,
|
|
912
|
+
chunkSize: n.chunkSize || 1e4,
|
|
913
|
+
strategy: n.strategy || "static",
|
|
914
|
+
ordered: n.ordered ?? !1,
|
|
915
|
+
allowSideEffects: n.allowSideEffects ?? !1
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
map(t) {
|
|
919
|
+
if (this.hasUnsafeOps()) throw Error("Cannot apply map after operations that cannot be parallelized");
|
|
920
|
+
return new e(this.source, [...this.ops, {
|
|
921
|
+
type: "map",
|
|
922
|
+
fn: t
|
|
923
|
+
}], this.config);
|
|
924
|
+
}
|
|
925
|
+
filter(t) {
|
|
926
|
+
if (this.hasUnsafeOps()) throw Error("Cannot apply filter after operations that cannot be parallelized");
|
|
927
|
+
return new e(this.source, [...this.ops, {
|
|
928
|
+
type: "filter",
|
|
929
|
+
fn: t
|
|
930
|
+
}], this.config);
|
|
931
|
+
}
|
|
932
|
+
async sum() {
|
|
933
|
+
if (this.hasUnsafeOps()) throw Error("Cannot perform sum after operations that cannot be parallelized");
|
|
934
|
+
let e = [...this.ops, {
|
|
935
|
+
type: "sum",
|
|
936
|
+
fn: (e, t) => e + t
|
|
937
|
+
}];
|
|
938
|
+
return await this.executeReduction(e, (e) => e.reduce((e, t) => {
|
|
939
|
+
let n = Array.isArray(t) && t.length > 0 ? t[0] : t;
|
|
940
|
+
return e + Number(n);
|
|
941
|
+
}, 0));
|
|
942
|
+
}
|
|
943
|
+
async count() {
|
|
944
|
+
if (this.hasUnsafeOps()) throw Error("Cannot perform count after operations that cannot be parallelized");
|
|
945
|
+
return await this.executeReduction(this.ops, (e) => e.reduce((e, t) => e + (Array.isArray(t) ? t.length : 1), 0));
|
|
946
|
+
}
|
|
947
|
+
async reduce(e, t) {
|
|
948
|
+
if (this.hasUnsafeOps()) throw Error("Cannot perform reduce after operations that cannot be parallelized");
|
|
949
|
+
let n = [...this.ops, {
|
|
950
|
+
type: "reduce",
|
|
951
|
+
fn: e
|
|
952
|
+
}];
|
|
953
|
+
return await this.executeReduction(n, (n) => {
|
|
954
|
+
if (n.length === 0 && t !== void 0) return t;
|
|
955
|
+
let r = n.map((e) => Array.isArray(e) && e.length > 0 ? e[0] : e);
|
|
956
|
+
return r.length === 1 ? r[0] : r.reduce((t, n) => e(t, n), t);
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
hasUnsafeOps() {
|
|
960
|
+
for (let e of this.ops) switch (e.type) {
|
|
961
|
+
case "take":
|
|
962
|
+
case "takeWhile":
|
|
963
|
+
case "find":
|
|
964
|
+
case "first":
|
|
965
|
+
case "scan":
|
|
966
|
+
case "inspect": return !0;
|
|
967
|
+
default: break;
|
|
968
|
+
}
|
|
969
|
+
return !1;
|
|
970
|
+
}
|
|
971
|
+
checkSideEffectsAllowed() {
|
|
972
|
+
if (!this.config.allowSideEffects) {
|
|
973
|
+
for (let e of this.ops) if (e.type === "inspect") throw Error("Inspect operations are not allowed when allowSideEffects is false");
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
async executeReduction(e, t) {
|
|
977
|
+
let n = Array.from(this.source), r = this.splitIntoChunks(n);
|
|
978
|
+
return t(await this.processChunksParallel(r, e));
|
|
979
|
+
}
|
|
980
|
+
splitIntoChunks(e) {
|
|
981
|
+
return this.config.strategy, this.staticChunking(e);
|
|
982
|
+
}
|
|
983
|
+
staticChunking(e) {
|
|
984
|
+
let t = [], n = Math.max(1, this.config.chunkSize), r = Math.min(this.config.workers, e.length), i = Math.max(1, Math.ceil(e.length / r)), a = Math.min(n, i);
|
|
985
|
+
for (let n = 0; n < e.length; n += a) t.push(e.slice(n, n + a));
|
|
986
|
+
return t;
|
|
987
|
+
}
|
|
988
|
+
async processChunksParallel(e, t) {
|
|
989
|
+
return typeof Worker < "u" ? this.processWithWebWorkers(e, t) : this.processWithBunWorkers(e, t);
|
|
990
|
+
}
|
|
991
|
+
async processWithWebWorkers(e, t) {
|
|
992
|
+
let n = Array(e.length), r = [];
|
|
993
|
+
for (let i = 0; i < Math.min(e.length, this.config.workers); i++) {
|
|
994
|
+
let a = i, o = (async () => {
|
|
995
|
+
for (let r = a; r < e.length; r += this.config.workers) n[r] = await this.processChunk(e[r], t);
|
|
996
|
+
})();
|
|
997
|
+
r.push(o);
|
|
998
|
+
}
|
|
999
|
+
return await Promise.all(r), n;
|
|
1000
|
+
}
|
|
1001
|
+
async processWithBunWorkers(e, t) {
|
|
1002
|
+
let n = [];
|
|
1003
|
+
for (let r of e) {
|
|
1004
|
+
let e = await this.processChunk(r, t);
|
|
1005
|
+
n.push(e);
|
|
1006
|
+
}
|
|
1007
|
+
return n;
|
|
1008
|
+
}
|
|
1009
|
+
async processChunk(e, t) {
|
|
1010
|
+
let n = [...e];
|
|
1011
|
+
for (let e of t) switch (e.type) {
|
|
1012
|
+
case "map":
|
|
1013
|
+
n = n.map((t, n) => e.fn(t, n));
|
|
1014
|
+
break;
|
|
1015
|
+
case "filter":
|
|
1016
|
+
n = n.filter((t, n) => e.fn(t, n));
|
|
1017
|
+
break;
|
|
1018
|
+
case "sum":
|
|
1019
|
+
n = [n.reduce((e, t) => e + Number(t), 0)];
|
|
1020
|
+
break;
|
|
1021
|
+
case "count":
|
|
1022
|
+
n = [n.length];
|
|
1023
|
+
break;
|
|
1024
|
+
case "reduce":
|
|
1025
|
+
if (n.length > 0) {
|
|
1026
|
+
let t = e.fn;
|
|
1027
|
+
n = [n.reduce(t)];
|
|
1028
|
+
} else n = [];
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
return n;
|
|
1032
|
+
}
|
|
1033
|
+
async collect() {
|
|
1034
|
+
if (this.hasUnsafeOps()) throw Error("Cannot collect after operations that cannot be parallelized");
|
|
1035
|
+
return await this.executeReduction(this.ops, (e) => {
|
|
1036
|
+
let t = [];
|
|
1037
|
+
for (let n of e) Array.isArray(n) ? t.push(...n) : t.push(n);
|
|
1038
|
+
return t;
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
take(e) {
|
|
1042
|
+
throw Error("take operation cannot be parallelized");
|
|
1043
|
+
}
|
|
1044
|
+
takeWhile(e) {
|
|
1045
|
+
throw Error("takeWhile operation cannot be parallelized");
|
|
1046
|
+
}
|
|
1047
|
+
find(e) {
|
|
1048
|
+
throw Error("find operation cannot be parallelized");
|
|
1049
|
+
}
|
|
1050
|
+
first() {
|
|
1051
|
+
throw Error("first operation cannot be parallelized");
|
|
1052
|
+
}
|
|
1053
|
+
scan(e, t) {
|
|
1054
|
+
throw Error("scan operation cannot be parallelized");
|
|
1055
|
+
}
|
|
1056
|
+
inspect(t) {
|
|
1057
|
+
if (!this.config.allowSideEffects) throw Error("inspect operation is not allowed when allowSideEffects is false");
|
|
1058
|
+
return new e(this.source, [...this.ops, {
|
|
1059
|
+
type: "inspect",
|
|
1060
|
+
fn: t
|
|
1061
|
+
}], this.config);
|
|
1062
|
+
}
|
|
870
1063
|
};
|
|
871
1064
|
function match(e) {
|
|
872
1065
|
return function(t) {
|
|
@@ -1064,5 +1257,242 @@ var Bimap = class e {
|
|
|
1064
1257
|
for (let n of e) t.enqueue(n);
|
|
1065
1258
|
return t;
|
|
1066
1259
|
}
|
|
1260
|
+
}, History = class e {
|
|
1261
|
+
states;
|
|
1262
|
+
currentIndex;
|
|
1263
|
+
limit;
|
|
1264
|
+
equals;
|
|
1265
|
+
subscribers;
|
|
1266
|
+
inTransaction;
|
|
1267
|
+
transactionQueue;
|
|
1268
|
+
transactionStates;
|
|
1269
|
+
constructor(e, t = {}) {
|
|
1270
|
+
this.states = [e], this.currentIndex = 0, this.limit = t.limit ?? Infinity, this.equals = t.equals ?? Object.is, this.subscribers = /* @__PURE__ */ new Set(), this.inTransaction = !1, this.transactionQueue = [], this.transactionStates = [];
|
|
1271
|
+
}
|
|
1272
|
+
get state() {
|
|
1273
|
+
return this.inTransaction && this.transactionStates.length > 0 ? this.transactionStates[this.transactionStates.length - 1] : this.states[this.currentIndex];
|
|
1274
|
+
}
|
|
1275
|
+
get index() {
|
|
1276
|
+
return this.currentIndex;
|
|
1277
|
+
}
|
|
1278
|
+
get length() {
|
|
1279
|
+
return this.states.length;
|
|
1280
|
+
}
|
|
1281
|
+
set(e) {
|
|
1282
|
+
if (this.inTransaction) {
|
|
1283
|
+
this.transactionQueue.push(() => this._set(e));
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
this._set(e);
|
|
1287
|
+
}
|
|
1288
|
+
_addToHistory(e) {
|
|
1289
|
+
this.equals(this.state, e) || (this.currentIndex < this.states.length - 1 ? (this.states[this.currentIndex] = e, this.states = this.states.slice(0, this.currentIndex + 1)) : (this.states.push(e), this.currentIndex++), this.states.length > this.limit && (this.states.shift(), this.currentIndex > 0 && this.currentIndex--), this._notify());
|
|
1290
|
+
}
|
|
1291
|
+
_set(e) {
|
|
1292
|
+
if (this.inTransaction) {
|
|
1293
|
+
this.transactionStates.push(e);
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
this._addToHistory(e);
|
|
1297
|
+
}
|
|
1298
|
+
update(e) {
|
|
1299
|
+
if (this.inTransaction) {
|
|
1300
|
+
this.transactionQueue.push(() => this._update(e));
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
this._update(e);
|
|
1304
|
+
}
|
|
1305
|
+
_update(e) {
|
|
1306
|
+
let t = e(this.state);
|
|
1307
|
+
this._set(t);
|
|
1308
|
+
}
|
|
1309
|
+
undo() {
|
|
1310
|
+
if (this.inTransaction) {
|
|
1311
|
+
this.transactionQueue.push(() => this._undo());
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
this._undo();
|
|
1315
|
+
}
|
|
1316
|
+
_undo() {
|
|
1317
|
+
this.currentIndex > 0 && (this.currentIndex--, this._notify());
|
|
1318
|
+
}
|
|
1319
|
+
redo() {
|
|
1320
|
+
if (this.inTransaction) {
|
|
1321
|
+
this.transactionQueue.push(() => this._redo());
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
this._redo();
|
|
1325
|
+
}
|
|
1326
|
+
_redo() {
|
|
1327
|
+
this.currentIndex < this.states.length - 1 && (this.currentIndex++, this._notify());
|
|
1328
|
+
}
|
|
1329
|
+
get canUndo() {
|
|
1330
|
+
return this.currentIndex > 0;
|
|
1331
|
+
}
|
|
1332
|
+
get canRedo() {
|
|
1333
|
+
return this.currentIndex < this.states.length - 1;
|
|
1334
|
+
}
|
|
1335
|
+
subscribe(e) {
|
|
1336
|
+
return this.subscribers.add(e), () => {
|
|
1337
|
+
this.subscribers.delete(e);
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
_notify() {
|
|
1341
|
+
for (let e of this.subscribers) e(this.state);
|
|
1342
|
+
}
|
|
1343
|
+
transaction(e) {
|
|
1344
|
+
if (this.inTransaction) {
|
|
1345
|
+
e();
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
this.inTransaction = !0, this.transactionQueue = [], this.transactionStates = [];
|
|
1349
|
+
try {
|
|
1350
|
+
e();
|
|
1351
|
+
for (let e of this.transactionQueue) e();
|
|
1352
|
+
} finally {
|
|
1353
|
+
if (this.inTransaction = !1, this.transactionStates.length > 0) {
|
|
1354
|
+
let e = this.transactionStates[this.transactionStates.length - 1];
|
|
1355
|
+
this._addToHistory(e);
|
|
1356
|
+
}
|
|
1357
|
+
this.transactionQueue = [], this.transactionStates = [];
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
clear() {
|
|
1361
|
+
this.states = [this.states[this.currentIndex]], this.currentIndex = 0;
|
|
1362
|
+
}
|
|
1363
|
+
static from(t, n) {
|
|
1364
|
+
let r = Array.from(t);
|
|
1365
|
+
if (r.length === 0) throw Error("Cannot create History from empty iterable");
|
|
1366
|
+
let i = new e(r[0], n);
|
|
1367
|
+
for (let e = 1; e < r.length; e++) i._set(r[e]);
|
|
1368
|
+
return i;
|
|
1369
|
+
}
|
|
1370
|
+
static withPatches(e, t) {
|
|
1371
|
+
return new PatchHistory(e, t);
|
|
1372
|
+
}
|
|
1373
|
+
}, PatchHistory = class {
|
|
1374
|
+
currentState;
|
|
1375
|
+
patches;
|
|
1376
|
+
currentIndex;
|
|
1377
|
+
limit;
|
|
1378
|
+
diff;
|
|
1379
|
+
apply;
|
|
1380
|
+
invert;
|
|
1381
|
+
subscribers;
|
|
1382
|
+
inTransaction;
|
|
1383
|
+
transactionQueue;
|
|
1384
|
+
transactionStates;
|
|
1385
|
+
constructor(e, t) {
|
|
1386
|
+
this.currentState = e, this.patches = [[]], this.currentIndex = 0, this.limit = t.limit ?? Infinity, this.diff = t.diff, this.apply = t.apply, this.invert = t.invert, this.subscribers = /* @__PURE__ */ new Set(), this.inTransaction = !1, this.transactionQueue = [], this.transactionStates = [];
|
|
1387
|
+
}
|
|
1388
|
+
get state() {
|
|
1389
|
+
return this.inTransaction && this.transactionStates.length > 0 ? this.transactionStates[this.transactionStates.length - 1] : this.currentState;
|
|
1390
|
+
}
|
|
1391
|
+
get index() {
|
|
1392
|
+
return this.currentIndex;
|
|
1393
|
+
}
|
|
1394
|
+
get length() {
|
|
1395
|
+
return this.patches.length;
|
|
1396
|
+
}
|
|
1397
|
+
set(e) {
|
|
1398
|
+
if (this.inTransaction) {
|
|
1399
|
+
this.transactionQueue.push(() => this._set(e));
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
this._set(e);
|
|
1403
|
+
}
|
|
1404
|
+
_addToHistory(e) {
|
|
1405
|
+
let t = this.diff(this.currentState, e);
|
|
1406
|
+
if (t.length !== 0) {
|
|
1407
|
+
if (this.currentIndex < this.patches.length - 1) this.patches[this.currentIndex] = t, this.patches = this.patches.slice(0, this.currentIndex + 1), this.currentState = e;
|
|
1408
|
+
else {
|
|
1409
|
+
if (this.patches.length === this.limit) {
|
|
1410
|
+
let e = this.patches.shift();
|
|
1411
|
+
this.currentIndex > 0 && this.currentIndex--, e.length > 0 && (this.currentState = this.apply(this.currentState, this.invert(e)));
|
|
1412
|
+
}
|
|
1413
|
+
this.patches.push(t), this.currentIndex++, this.currentState = e;
|
|
1414
|
+
}
|
|
1415
|
+
this._notify();
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
_set(e) {
|
|
1419
|
+
if (this.inTransaction) {
|
|
1420
|
+
this.transactionStates.push(e);
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
this._addToHistory(e);
|
|
1424
|
+
}
|
|
1425
|
+
update(e) {
|
|
1426
|
+
if (this.inTransaction) {
|
|
1427
|
+
this.transactionQueue.push(() => this._update(e));
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
this._update(e);
|
|
1431
|
+
}
|
|
1432
|
+
_update(e) {
|
|
1433
|
+
let t = e(this.state);
|
|
1434
|
+
this._set(t);
|
|
1435
|
+
}
|
|
1436
|
+
undo() {
|
|
1437
|
+
if (this.inTransaction) {
|
|
1438
|
+
this.transactionQueue.push(() => this._undo());
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
this._undo();
|
|
1442
|
+
}
|
|
1443
|
+
_undo() {
|
|
1444
|
+
if (this.currentIndex > 0) {
|
|
1445
|
+
let e = this.patches[this.currentIndex];
|
|
1446
|
+
this.currentState = this.apply(this.currentState, this.invert(e)), this.currentIndex--, this._notify();
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
redo() {
|
|
1450
|
+
if (this.inTransaction) {
|
|
1451
|
+
this.transactionQueue.push(() => this._redo());
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
this._redo();
|
|
1455
|
+
}
|
|
1456
|
+
_redo() {
|
|
1457
|
+
if (this.currentIndex < this.patches.length - 1) {
|
|
1458
|
+
this.currentIndex++;
|
|
1459
|
+
let e = this.patches[this.currentIndex];
|
|
1460
|
+
this.currentState = this.apply(this.currentState, e), this._notify();
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
get canUndo() {
|
|
1464
|
+
return this.currentIndex > 0;
|
|
1465
|
+
}
|
|
1466
|
+
get canRedo() {
|
|
1467
|
+
return this.currentIndex < this.patches.length - 1;
|
|
1468
|
+
}
|
|
1469
|
+
subscribe(e) {
|
|
1470
|
+
return this.subscribers.add(e), () => {
|
|
1471
|
+
this.subscribers.delete(e);
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
_notify() {
|
|
1475
|
+
for (let e of this.subscribers) e(this.state);
|
|
1476
|
+
}
|
|
1477
|
+
transaction(e) {
|
|
1478
|
+
if (this.inTransaction) {
|
|
1479
|
+
e();
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1482
|
+
this.inTransaction = !0, this.transactionQueue = [], this.transactionStates = [];
|
|
1483
|
+
try {
|
|
1484
|
+
e();
|
|
1485
|
+
for (let e of this.transactionQueue) e();
|
|
1486
|
+
} finally {
|
|
1487
|
+
if (this.inTransaction = !1, this.transactionStates.length > 0) {
|
|
1488
|
+
let e = this.transactionStates[this.transactionStates.length - 1];
|
|
1489
|
+
this._addToHistory(e);
|
|
1490
|
+
}
|
|
1491
|
+
this.transactionQueue = [], this.transactionStates = [];
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
clear() {
|
|
1495
|
+
this.patches = [this.patches[this.currentIndex]], this.currentIndex = 0;
|
|
1496
|
+
}
|
|
1067
1497
|
};
|
|
1068
|
-
export { Bimap, Err, Iter, None, Ok, Queue, Some, Stack, dispatch, isArray, isBoolean, isFunction, isNull, isNumber, isObject, isString, isUndefined, match };
|
|
1498
|
+
export { Bimap, Err, History, Iter, None, Ok, ParIter, PatchHistory, Queue, Some, Stack, dispatch, isArray, isBoolean, isFunction, isNull, isNumber, isObject, isString, isUndefined, match };
|
package/dist/iterator/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package/iterator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/package/iterator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,OAAO,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/C;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,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;CAmBnB"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Типы операций в pipeline для ParIter
|
|
3
|
+
*/
|
|
4
|
+
type ParOpType = "map" | "filter" | "reduce" | "sum" | "count" | "groupBy" | "take" | "takeWhile" | "find" | "first" | "scan" | "inspect";
|
|
5
|
+
/**
|
|
6
|
+
* Операция в pipeline ParIter
|
|
7
|
+
*/
|
|
8
|
+
interface ParOp {
|
|
9
|
+
type: ParOpType;
|
|
10
|
+
fn: Function;
|
|
11
|
+
param?: unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Конфигурация для ParIter
|
|
15
|
+
*/
|
|
16
|
+
export interface ParIterConfig {
|
|
17
|
+
workers?: number;
|
|
18
|
+
chunkSize?: number;
|
|
19
|
+
strategy?: "static" | "dynamic";
|
|
20
|
+
ordered?: boolean;
|
|
21
|
+
allowSideEffects?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Параллельный итератор для data-parallel execution с deterministic reduction.
|
|
25
|
+
*
|
|
26
|
+
* ParIter = data-parallel execution + deterministic reduction
|
|
27
|
+
*
|
|
28
|
+
* Основные принципы:
|
|
29
|
+
* - Разбиение источника (split)
|
|
30
|
+
* - Параллельная обработка чанков
|
|
31
|
+
* - Контролируемая агрегация (reduce / collect / fold)
|
|
32
|
+
* - Не все операции можно параллелизировать
|
|
33
|
+
* - lazy-chain → eager-execution boundary
|
|
34
|
+
*/
|
|
35
|
+
export declare class ParIter<T> {
|
|
36
|
+
private readonly source;
|
|
37
|
+
private readonly ops;
|
|
38
|
+
private readonly config;
|
|
39
|
+
private readonly opsMask;
|
|
40
|
+
constructor(source: Iterable<T>, ops?: ParOp[], config?: ParIterConfig);
|
|
41
|
+
/**
|
|
42
|
+
* Создаёт ParIter из итерируемого объекта
|
|
43
|
+
*/
|
|
44
|
+
static from<T>(iterable: Iterable<T>, config?: ParIterConfig): ParIter<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Альтернативный способ создания ParIter с явной конфигурацией
|
|
47
|
+
*/
|
|
48
|
+
static create<T>(iterable: Iterable<T>, config?: ParIterConfig): ParIter<T>;
|
|
49
|
+
/**
|
|
50
|
+
* Применяет функцию к каждому элементу (параллелизируемая операция)
|
|
51
|
+
*/
|
|
52
|
+
map<U>(fn: (value: T, index: number) => U): ParIter<U>;
|
|
53
|
+
/**
|
|
54
|
+
* Фильтрует элементы по предикату (параллелизируемая операция)
|
|
55
|
+
*/
|
|
56
|
+
filter(predicate: (value: T, index: number) => boolean): ParIter<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Суммирует элементы (операция редукции)
|
|
59
|
+
*/
|
|
60
|
+
sum(): Promise<number>;
|
|
61
|
+
/**
|
|
62
|
+
* Подсчитывает количество элементов (операция редукции)
|
|
63
|
+
*/
|
|
64
|
+
count(): Promise<number>;
|
|
65
|
+
/**
|
|
66
|
+
* Выполняет редукцию с ассоциативной функцией (операция редукции)
|
|
67
|
+
*/
|
|
68
|
+
reduce<U>(reducer: (acc: U, value: T) => U, initial?: U): Promise<U>;
|
|
69
|
+
/**
|
|
70
|
+
* Проверяет, есть ли в pipeline операции, которые нельзя параллелизировать
|
|
71
|
+
*/
|
|
72
|
+
private hasUnsafeOps;
|
|
73
|
+
/**
|
|
74
|
+
* Проверяет, разрешены ли побочные эффекты
|
|
75
|
+
*/
|
|
76
|
+
private checkSideEffectsAllowed;
|
|
77
|
+
/**
|
|
78
|
+
* Выполняет редукцию параллельно
|
|
79
|
+
*/
|
|
80
|
+
private executeReduction;
|
|
81
|
+
/**
|
|
82
|
+
* Разбивает данные на чанки в зависимости от стратегии
|
|
83
|
+
*/
|
|
84
|
+
private splitIntoChunks;
|
|
85
|
+
/**
|
|
86
|
+
* Статическое разбиение на чанки
|
|
87
|
+
*/
|
|
88
|
+
private staticChunking;
|
|
89
|
+
/**
|
|
90
|
+
* Обрабатывает чанки параллельно с использованием Web Workers
|
|
91
|
+
*/
|
|
92
|
+
private processChunksParallel;
|
|
93
|
+
/**
|
|
94
|
+
* Обработка с использованием Web Workers (браузер)
|
|
95
|
+
*/
|
|
96
|
+
private processWithWebWorkers;
|
|
97
|
+
/**
|
|
98
|
+
* Обработка с использованием Bun Workers (Bun runtime)
|
|
99
|
+
*/
|
|
100
|
+
private processWithBunWorkers;
|
|
101
|
+
/**
|
|
102
|
+
* Обрабатывает один чанк с применением pipeline
|
|
103
|
+
*/
|
|
104
|
+
private processChunk;
|
|
105
|
+
/**
|
|
106
|
+
* Собирает результаты в массив (операция редукции)
|
|
107
|
+
*/
|
|
108
|
+
collect(): Promise<T[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Берёт первые n элементов - НЕЛЬЗЯ параллелить
|
|
111
|
+
*/
|
|
112
|
+
take(n: number): never;
|
|
113
|
+
/**
|
|
114
|
+
* Берёт элементы пока предикат возвращает true - НЕЛЬЗЯ параллелить
|
|
115
|
+
*/
|
|
116
|
+
takeWhile(predicate: (value: T, index: number) => boolean): never;
|
|
117
|
+
/**
|
|
118
|
+
* Находит элемент - НЕЛЬЗЯ параллелить
|
|
119
|
+
*/
|
|
120
|
+
find(predicate: (value: T, index: number) => boolean): never;
|
|
121
|
+
/**
|
|
122
|
+
* Получает первый элемент - НЕЛЬЗЯ параллелить
|
|
123
|
+
*/
|
|
124
|
+
first(): never;
|
|
125
|
+
/**
|
|
126
|
+
* Сканирует элементы - НЕЛЬЗЯ параллелить
|
|
127
|
+
*/
|
|
128
|
+
scan<U>(initial: U, accumulator: (acc: U, value: T) => U): never;
|
|
129
|
+
/**
|
|
130
|
+
* Инспектирует элементы - НЕЛЬЗЯ параллелить без разрешения
|
|
131
|
+
*/
|
|
132
|
+
inspect(fn: (value: T, index: number) => void): ParIter<T>;
|
|
133
|
+
}
|
|
134
|
+
export {};
|
|
135
|
+
//# sourceMappingURL=par-iter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"par-iter.d.ts","sourceRoot":"","sources":["../../src/package/iterator/par-iter.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,KAAK,SAAS,GACV,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,OAAO,GACP,SAAS,GACT,MAAM,GACN,WAAW,GACX,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,CAAC;AAEd;;GAEG;AACH,UAAU,KAAK;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAoBD;;;;;;;;;;;GAWG;AACH,qBAAa,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAG/B,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,GAAG,GAAE,KAAK,EAAO,EACjB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,CAAC;IAoB7B;;OAEG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,KAAK;IAItB;;OAEG;IACH,SAAS,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,KAAK;IAIjE;;OAEG;IACH,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,KAAK;IAI5D;;OAEG;IACH,KAAK,IAAI,KAAK;IAId;;OAEG;IACH,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK;IAIhE;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;CAY3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"par-worker.d.ts","sourceRoot":"","sources":["../../src/package/iterator/par-worker.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dayme/alien-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript utility library with functional programming data structures (Option, Result, Iter, Stack, Queue, Bimap, Match, Dispatch)",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"prepublishOnly": "bun run build",
|
|
45
45
|
"test": "bun test",
|
|
46
46
|
"test:watch": "bun test --watch",
|
|
47
|
-
"bench": "bun run tests/iterator.bench.ts",
|
|
48
47
|
"playground:dev": "vite dev --config app/playground/vite.config.ts",
|
|
49
48
|
"playground": "concurrently \"bun run dev\" \"bun run playground:dev\"",
|
|
50
49
|
"docs:dev": "cd app/docs && vite",
|
|
@@ -59,12 +58,10 @@
|
|
|
59
58
|
"typescript": "~5.9.3",
|
|
60
59
|
"vite": "npm:rolldown-vite@7.2.5",
|
|
61
60
|
"vite-plugin-dts": "^4.3.0",
|
|
62
|
-
"
|
|
61
|
+
"@types/bun": "^1.3.5"
|
|
63
62
|
},
|
|
64
63
|
"overrides": {
|
|
65
64
|
"vite": "npm:rolldown-vite@7.2.5"
|
|
66
65
|
},
|
|
67
|
-
"dependencies": {
|
|
68
|
-
"@types/bun": "^1.3.5"
|
|
69
|
-
}
|
|
66
|
+
"dependencies": {}
|
|
70
67
|
}
|