iterable-linq-utility 0.0.9 → 0.0.10
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/dist/functions/collectToArray.d.ts +1 -0
- package/dist/functions/empty.d.ts +1 -0
- package/dist/functions/filter.d.ts +7 -0
- package/dist/functions/index.d.ts +21 -8
- package/dist/functions/map.d.ts +7 -0
- package/dist/functions/materialize.d.ts +6 -0
- package/dist/functions/max.d.ts +9 -1
- package/dist/functions/memoize.d.ts +6 -0
- package/dist/functions/min.d.ts +7 -0
- package/dist/functions/range.d.ts +1 -0
- package/dist/functions/reduce.d.ts +10 -0
- package/dist/functions/repeat.d.ts +1 -0
- package/dist/functions/some.d.ts +7 -0
- package/dist/functions/tap.d.ts +9 -0
- package/dist/functions/tapChain.d.ts +9 -0
- package/dist/genericCollections/index.d.ts +2 -1
- package/dist/genericCollections/linkedList.d.ts +7 -5
- package/dist/index.d.ts +13 -3
- package/dist/interable-linq-utility.js +339 -117
- package/dist/interable-linq-utility.umd.cjs +1 -1
- package/dist/linqIterable.d.ts +26 -11
- package/dist/types/index.d.ts +3 -0
- package/dist/types/reducer.d.ts +1 -0
- package/dist/types/tapper.d.ts +1 -0
- package/dist/types/unit.d.ts +3 -0
- package/dist/utils/iteratorResults.d.ts +1 -1
- package/dist/utils/utils.d.ts +0 -26
- package/package.json +9 -4
- package/dist/combiners/index.d.ts +0 -2
- package/dist/combiners/mapper.d.ts +0 -2
- package/dist/combiners/predicate.d.ts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function collectToArray<T>(iterable: Iterable<T>): T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function empty<T>(): Iterable<T>;
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { collectToArray } from './collectToArray';
|
|
2
|
+
export { collectToArray };
|
|
3
|
+
import { empty } from './empty';
|
|
4
|
+
export { empty };
|
|
5
|
+
import { filter } from './filter';
|
|
6
|
+
export { filter };
|
|
7
|
+
import { map } from './map';
|
|
8
|
+
import { materialize } from './materialize';
|
|
9
|
+
import { max } from './max';
|
|
10
|
+
import { memoize } from './memoize';
|
|
11
|
+
import { min } from './min';
|
|
12
|
+
export { map, materialize, max, memoize, min };
|
|
13
|
+
import { range } from './range';
|
|
14
|
+
import { reduce } from './reduce';
|
|
15
|
+
import { repeat } from './repeat';
|
|
16
|
+
export { range, reduce, repeat };
|
|
17
|
+
import { some } from './some';
|
|
18
|
+
export { some };
|
|
19
|
+
import { tap } from './tap';
|
|
20
|
+
import { tapChain } from './tapChain';
|
|
21
|
+
export { tap, tapChain };
|
package/dist/functions/map.d.ts
CHANGED
package/dist/functions/max.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Comparer } from "@/types";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @operation `Action`
|
|
5
|
+
* @param iterable
|
|
6
|
+
* @param comparer
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function max<T>(iterable: Iterable<T>, comparer?: Comparer<T>): T | null | undefined;
|
package/dist/functions/min.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export declare function range(start: number, end: number): Iterable<number>;
|
|
|
4
4
|
export declare function range(start: number, end: number, step: number): Iterable<number>;
|
|
5
5
|
export declare function range(start: number, end: number, reverse: boolean): Iterable<number>;
|
|
6
6
|
export declare function range(start: number, end: number, step: number, reverse: boolean): Iterable<number>;
|
|
7
|
+
export declare function range(start: number, end?: number | boolean, step?: number | boolean, reverse?: boolean): Iterable<number>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Reducer } from "@/types";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @operation `Action`
|
|
5
|
+
* @param iterable
|
|
6
|
+
* @param neutralElement
|
|
7
|
+
* @param reducer
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function reduce<T, R>(iterable: Iterable<T>, neutralElement: R, reducer: Reducer<T, R>): R;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function repeat<T>(value: T, count: number): Iterable<T>;
|
package/dist/functions/some.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import * as LinkedListCollection from './linkedList';
|
|
2
|
+
export { LinkedListCollection };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
export declare function from<T>(iterable: Iterable<T>): LinkedList<T>;
|
|
2
|
-
export declare class LinkedListIterator<T> implements Iterator<T> {
|
|
3
|
-
private current;
|
|
4
|
-
constructor(current?: IListNode<T> | null);
|
|
5
|
-
next(): IteratorResult<T, any>;
|
|
6
|
-
}
|
|
7
2
|
export declare class LinkedList<T> implements Iterable<T> {
|
|
8
3
|
private internalSize;
|
|
9
4
|
private head;
|
|
10
5
|
private tail;
|
|
11
6
|
[Symbol.iterator](): Iterator<T>;
|
|
7
|
+
private internalAddFirst;
|
|
12
8
|
addFirst(value: T): this;
|
|
9
|
+
private internalAddLast;
|
|
13
10
|
addLast(value: T): this;
|
|
14
11
|
size(): number;
|
|
15
12
|
}
|
|
13
|
+
export declare class LinkedListIterator<T> implements Iterator<T> {
|
|
14
|
+
private current;
|
|
15
|
+
constructor(current?: IListNode<T> | null);
|
|
16
|
+
next(): IteratorResult<T, any>;
|
|
17
|
+
}
|
|
16
18
|
interface IListNode<T> {
|
|
17
19
|
data: T;
|
|
18
20
|
nextNode: IListNode<T> | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import { IterableLinqWrapper, type IIterableLinq } from "./linqIterable";
|
|
2
|
+
import * as Functions from '@/functions';
|
|
3
|
+
export declare function empty<T>(): IIterableLinq<T>;
|
|
4
|
+
export declare function from<T>(iterable: Iterable<T>): IIterableLinq<T>;
|
|
5
|
+
export declare function fromRange(end: number): IIterableLinq<number>;
|
|
6
|
+
export declare function fromRange(end: number, reverse?: boolean): IIterableLinq<number>;
|
|
7
|
+
export declare function fromRange(start: number, end: number): IIterableLinq<number>;
|
|
8
|
+
export declare function fromRange(start: number, end: number, step: number): IIterableLinq<number>;
|
|
9
|
+
export declare function fromRange(start: number, end: number, reverse: boolean): IIterableLinq<number>;
|
|
10
|
+
export declare function fromRange(start: number, end: number, step: number, reverse: boolean): IIterableLinq<number>;
|
|
11
|
+
export declare function fromRange(start: number, end?: number | boolean, step?: number | boolean, reverse?: boolean): Iterable<number>;
|
|
12
|
+
export declare function repeat<T>(value: T, count: number): IIterableLinq<T>;
|
|
13
|
+
export { Functions, IIterableLinq, IterableLinqWrapper };
|
|
@@ -1,43 +1,53 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var n = (e, t, r) => (
|
|
4
|
-
function
|
|
5
|
-
return (
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var C = (e, t, r) => t in e ? E(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var n = (e, t, r) => (C(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
function $(e) {
|
|
5
|
+
return Array.from(e);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
return (r, i) => e(r, i) && t(r, i);
|
|
9
|
-
}
|
|
10
|
-
function z(e, t) {
|
|
7
|
+
function f(e, t) {
|
|
11
8
|
return {
|
|
12
9
|
done: e,
|
|
13
10
|
value: t
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
|
-
function
|
|
17
|
-
return { done: !0, value:
|
|
13
|
+
function l(e) {
|
|
14
|
+
return { done: !0, value: e };
|
|
18
15
|
}
|
|
19
|
-
function
|
|
16
|
+
function m(e) {
|
|
20
17
|
return typeof e == "function";
|
|
21
18
|
}
|
|
22
|
-
function
|
|
23
|
-
return new
|
|
19
|
+
function w() {
|
|
20
|
+
return new j();
|
|
21
|
+
}
|
|
22
|
+
class j {
|
|
23
|
+
[Symbol.iterator]() {
|
|
24
|
+
return new O();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
class O {
|
|
28
|
+
next() {
|
|
29
|
+
return l();
|
|
30
|
+
}
|
|
31
|
+
return(t) {
|
|
32
|
+
return l(t);
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
|
-
|
|
35
|
+
function v(e, t) {
|
|
36
|
+
if (!m(t))
|
|
37
|
+
throw '"predicate" function must be provided';
|
|
38
|
+
return new B(e, t);
|
|
39
|
+
}
|
|
40
|
+
class B {
|
|
26
41
|
constructor(t, r) {
|
|
27
42
|
n(this, "predicate");
|
|
28
43
|
n(this, "source");
|
|
29
|
-
|
|
30
|
-
if (s instanceof f) {
|
|
31
|
-
const u = s.predicate;
|
|
32
|
-
s = s.source, i = p(u, i);
|
|
33
|
-
}
|
|
34
|
-
this.source = s, this.predicate = i;
|
|
44
|
+
this.source = t, this.predicate = r;
|
|
35
45
|
}
|
|
36
46
|
[Symbol.iterator]() {
|
|
37
|
-
return new
|
|
47
|
+
return new D(this.source, this.predicate);
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
|
-
class
|
|
50
|
+
class D {
|
|
41
51
|
constructor(t, r) {
|
|
42
52
|
n(this, "index", 0);
|
|
43
53
|
n(this, "sourceIterator");
|
|
@@ -52,25 +62,22 @@ class L {
|
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
65
|
+
function g(e, t) {
|
|
66
|
+
if (!m(t))
|
|
67
|
+
throw '"mapper" function must be provided';
|
|
68
|
+
return new P(e, t);
|
|
57
69
|
}
|
|
58
|
-
class
|
|
70
|
+
class P {
|
|
59
71
|
constructor(t, r) {
|
|
60
72
|
n(this, "mapper");
|
|
61
73
|
n(this, "source");
|
|
62
|
-
|
|
63
|
-
if (s instanceof m) {
|
|
64
|
-
const u = s.mapper;
|
|
65
|
-
s = s.source, i = y(u, i);
|
|
66
|
-
}
|
|
67
|
-
this.source = t, this.mapper = i;
|
|
74
|
+
this.source = t, this.mapper = r;
|
|
68
75
|
}
|
|
69
76
|
[Symbol.iterator]() {
|
|
70
|
-
return new
|
|
77
|
+
return new G(this.source, this.mapper);
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
|
-
class
|
|
80
|
+
class G {
|
|
74
81
|
constructor(t, r) {
|
|
75
82
|
n(this, "index", 0);
|
|
76
83
|
n(this, "sourceIterator");
|
|
@@ -79,83 +86,83 @@ class N {
|
|
|
79
86
|
}
|
|
80
87
|
next() {
|
|
81
88
|
const t = this.sourceIterator.next();
|
|
82
|
-
return t.done !== !0 ?
|
|
89
|
+
return t.done !== !0 ? f(!1, this.mapper(t.value, this.index++)) : l();
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
|
-
function
|
|
86
|
-
const t = e[Symbol.iterator](), r = new
|
|
92
|
+
function H(e) {
|
|
93
|
+
const t = e[Symbol.iterator](), r = new x();
|
|
87
94
|
for (let i = t.next(); i.done !== !0; i = t.next())
|
|
88
95
|
r.addLast(i.value);
|
|
89
96
|
return r;
|
|
90
97
|
}
|
|
91
|
-
class
|
|
92
|
-
constructor(t = null) {
|
|
93
|
-
n(this, "current", null);
|
|
94
|
-
this.current = t;
|
|
95
|
-
}
|
|
96
|
-
next() {
|
|
97
|
-
const t = this.current;
|
|
98
|
-
return t === null ? S() : (this.current = t.nextNode, z(!1, t.data));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
class h {
|
|
98
|
+
class x {
|
|
102
99
|
constructor() {
|
|
103
100
|
n(this, "internalSize", 0);
|
|
104
101
|
n(this, "head", null);
|
|
105
102
|
n(this, "tail", null);
|
|
103
|
+
n(this, "internalAddFirst", (t) => {
|
|
104
|
+
const r = {
|
|
105
|
+
data: t,
|
|
106
|
+
nextNode: null
|
|
107
|
+
};
|
|
108
|
+
return this.head = r, this.tail = r, this.internalSize++, this.internalAddFirst = (i) => {
|
|
109
|
+
const o = {
|
|
110
|
+
data: i,
|
|
111
|
+
nextNode: null
|
|
112
|
+
};
|
|
113
|
+
return o.nextNode = this.head, this.head = o, this.internalSize++, this;
|
|
114
|
+
}, this;
|
|
115
|
+
});
|
|
116
|
+
n(this, "internalAddLast", (t) => {
|
|
117
|
+
const r = {
|
|
118
|
+
data: t,
|
|
119
|
+
nextNode: null
|
|
120
|
+
};
|
|
121
|
+
return this.head = r, this.tail = r, this.internalSize++, this.internalAddLast = (i) => {
|
|
122
|
+
const o = {
|
|
123
|
+
data: i,
|
|
124
|
+
nextNode: null
|
|
125
|
+
};
|
|
126
|
+
return this.tail.nextNode = o, this.tail = o, this.internalSize++, this;
|
|
127
|
+
}, this;
|
|
128
|
+
});
|
|
106
129
|
}
|
|
107
130
|
[Symbol.iterator]() {
|
|
108
|
-
return new
|
|
131
|
+
return new J(this.head);
|
|
109
132
|
}
|
|
110
133
|
addFirst(t) {
|
|
111
|
-
|
|
112
|
-
data: t,
|
|
113
|
-
nextNode: null
|
|
114
|
-
};
|
|
115
|
-
switch (this.internalSize) {
|
|
116
|
-
case 0:
|
|
117
|
-
this.head = r, this.tail = r;
|
|
118
|
-
break;
|
|
119
|
-
default:
|
|
120
|
-
r.nextNode = this.head, this.head = r;
|
|
121
|
-
}
|
|
122
|
-
return this.internalSize++, this;
|
|
134
|
+
return this.internalAddFirst(t);
|
|
123
135
|
}
|
|
124
136
|
addLast(t) {
|
|
125
|
-
|
|
126
|
-
data: t,
|
|
127
|
-
nextNode: null
|
|
128
|
-
};
|
|
129
|
-
switch (this.internalSize) {
|
|
130
|
-
case 0:
|
|
131
|
-
this.head = r, this.tail = r;
|
|
132
|
-
break;
|
|
133
|
-
default:
|
|
134
|
-
this.tail.nextNode = r, this.tail = r;
|
|
135
|
-
}
|
|
136
|
-
return this.internalSize++, this;
|
|
137
|
+
return this.internalAddLast(t);
|
|
137
138
|
}
|
|
138
139
|
size() {
|
|
139
140
|
return this.internalSize;
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
class J {
|
|
144
|
+
constructor(t = null) {
|
|
145
|
+
n(this, "current", null);
|
|
146
|
+
this.current = t;
|
|
147
|
+
}
|
|
148
|
+
next() {
|
|
149
|
+
const t = this.current;
|
|
150
|
+
return t === null ? l() : (this.current = t.nextNode, f(!1, t.data));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function z(e) {
|
|
154
|
+
return e instanceof y ? e : new y(e);
|
|
144
155
|
}
|
|
145
|
-
class
|
|
156
|
+
class y {
|
|
146
157
|
constructor(t) {
|
|
147
158
|
n(this, "source");
|
|
148
|
-
|
|
149
|
-
this.source = t;
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
this.source = A(t);
|
|
159
|
+
this.source = H(t);
|
|
153
160
|
}
|
|
154
161
|
[Symbol.iterator]() {
|
|
155
|
-
return new
|
|
162
|
+
return new K(this.source);
|
|
156
163
|
}
|
|
157
164
|
}
|
|
158
|
-
class
|
|
165
|
+
class K {
|
|
159
166
|
constructor(t) {
|
|
160
167
|
n(this, "sourceIterator");
|
|
161
168
|
this.sourceIterator = t[Symbol.iterator]();
|
|
@@ -164,22 +171,37 @@ class P {
|
|
|
164
171
|
return this.sourceIterator.next();
|
|
165
172
|
}
|
|
166
173
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
174
|
+
function N(e, t) {
|
|
175
|
+
const r = e[Symbol.iterator]();
|
|
176
|
+
let i = r.next(), o = i.value, u = null;
|
|
177
|
+
for (t == null ? u = (s, a) => s < a ? -1 : s === a ? 0 : 1 : m(t) ? u = t : Array.isArray(t) ? u = (s, a) => {
|
|
178
|
+
let c = 0;
|
|
179
|
+
for (const h of t)
|
|
180
|
+
if (c = s[h] < a[h] ? -1 : s[h] === a[h] ? 0 : 1, c !== 0)
|
|
181
|
+
break;
|
|
182
|
+
return c;
|
|
183
|
+
} : u = (s, a) => s[t] < a[t] ? -1 : s[t] === a[t] ? 0 : 1, i = r.next(); i.done !== !0; i = r.next()) {
|
|
184
|
+
const s = u(o, i.value);
|
|
185
|
+
o = s > 0 || s === 0 ? o : i.value;
|
|
186
|
+
}
|
|
187
|
+
return o == null ? null : o;
|
|
169
188
|
}
|
|
170
|
-
|
|
189
|
+
function M(e) {
|
|
190
|
+
return e instanceof S ? e : new S(e);
|
|
191
|
+
}
|
|
192
|
+
class S {
|
|
171
193
|
constructor(t) {
|
|
172
194
|
n(this, "isMemoized", !1);
|
|
173
195
|
n(this, "sourceIterator");
|
|
174
|
-
n(this, "linkedList", new
|
|
196
|
+
n(this, "linkedList", new x());
|
|
175
197
|
n(this, "source");
|
|
176
|
-
this.source = t, this.sourceIterator = t[Symbol.iterator](), t instanceof
|
|
198
|
+
this.source = t, this.sourceIterator = t[Symbol.iterator](), t instanceof x && (this.linkedList = t, this.isMemoized = !0);
|
|
177
199
|
}
|
|
178
200
|
[Symbol.iterator]() {
|
|
179
|
-
return this.isMemoized ? new
|
|
201
|
+
return this.isMemoized ? new U(this.linkedList) : new Q(this.sourceIterator, this.linkedList, (t) => this.isMemoized = t.done === !0);
|
|
180
202
|
}
|
|
181
203
|
}
|
|
182
|
-
class
|
|
204
|
+
class Q {
|
|
183
205
|
constructor(t, r, i) {
|
|
184
206
|
n(this, "index", 0);
|
|
185
207
|
n(this, "linkedList");
|
|
@@ -195,7 +217,7 @@ class D {
|
|
|
195
217
|
return this.setAsMemoized(t) || this.linkedList.addLast(t.value), t;
|
|
196
218
|
}
|
|
197
219
|
}
|
|
198
|
-
class
|
|
220
|
+
class U {
|
|
199
221
|
constructor(t) {
|
|
200
222
|
n(this, "memoizedSourceIterator");
|
|
201
223
|
this.memoizedSourceIterator = t[Symbol.iterator]();
|
|
@@ -204,30 +226,202 @@ class T {
|
|
|
204
226
|
return this.memoizedSourceIterator.next();
|
|
205
227
|
}
|
|
206
228
|
}
|
|
207
|
-
function
|
|
229
|
+
function R(e, t) {
|
|
208
230
|
const r = e[Symbol.iterator]();
|
|
209
|
-
let i = r.next(),
|
|
210
|
-
for (t == null ? u = (
|
|
211
|
-
let
|
|
212
|
-
for (const
|
|
213
|
-
if (
|
|
231
|
+
let i = r.next(), o = i.value, u = null;
|
|
232
|
+
for (t == null ? u = (s, a) => s < a ? -1 : s === a ? 0 : 1 : m(t) ? u = t : Array.isArray(t) ? u = (s, a) => {
|
|
233
|
+
let c = 0;
|
|
234
|
+
for (const h of t)
|
|
235
|
+
if (c = s[h] < a[h] ? -1 : s[h] === a[h] ? 0 : 1, c !== 0)
|
|
214
236
|
break;
|
|
215
|
-
return
|
|
216
|
-
} : u = (
|
|
217
|
-
const
|
|
218
|
-
|
|
237
|
+
return c;
|
|
238
|
+
} : u = (s, a) => s[t] < a[t] ? -1 : s[t] === a[t] ? 0 : 1, i = r.next(); i.done !== !0; i = r.next()) {
|
|
239
|
+
const s = u(o, i.value);
|
|
240
|
+
o = s < 0 || s === 0 ? o : i.value;
|
|
241
|
+
}
|
|
242
|
+
return o == null ? null : o;
|
|
243
|
+
}
|
|
244
|
+
function k(e, t, r, i) {
|
|
245
|
+
const o = t == null || t === !0 || t === !1 ? e : t, u = t == null || t === !0 || t === !1 ? 0 : e, s = u < o, a = r !== !0 && r !== !1 && r != null && r !== 0 ? r : s ? 1 : -1, c = s && a < 0 || !s && a > 0 ? -1 * a : a, h = Math.ceil(Math.abs(o - u) / Math.abs(c)), I = !!(t === !0 || r === !0 || i != null && i), p = I ? h * c + u : u;
|
|
246
|
+
return u === o ? new q(p, 0, 0) : I ? new Z(p, h, c) : new X(p, h, c);
|
|
247
|
+
}
|
|
248
|
+
class X {
|
|
249
|
+
constructor(t, r, i) {
|
|
250
|
+
n(this, "initialValue");
|
|
251
|
+
n(this, "length");
|
|
252
|
+
n(this, "step");
|
|
253
|
+
this.initialValue = t, this.length = r, this.step = i;
|
|
254
|
+
}
|
|
255
|
+
[Symbol.iterator]() {
|
|
256
|
+
return new Y(this.initialValue, this.length, this.step);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
class Y {
|
|
260
|
+
constructor(t, r, i) {
|
|
261
|
+
n(this, "value");
|
|
262
|
+
n(this, "length");
|
|
263
|
+
n(this, "step");
|
|
264
|
+
this.value = t, this.length = r, this.step = i;
|
|
265
|
+
}
|
|
266
|
+
next() {
|
|
267
|
+
const t = this.value;
|
|
268
|
+
return this.value += this.step, this.length-- ? f(!1, t) : l();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
class Z {
|
|
272
|
+
constructor(t, r, i) {
|
|
273
|
+
n(this, "initialValue");
|
|
274
|
+
n(this, "length");
|
|
275
|
+
n(this, "step");
|
|
276
|
+
this.initialValue = t - i, this.length = r, this.step = i;
|
|
277
|
+
}
|
|
278
|
+
[Symbol.iterator]() {
|
|
279
|
+
return new _(this.initialValue, this.length, this.step);
|
|
219
280
|
}
|
|
220
|
-
return s == null ? null : s;
|
|
221
281
|
}
|
|
222
|
-
|
|
282
|
+
class _ {
|
|
283
|
+
constructor(t, r, i) {
|
|
284
|
+
n(this, "value");
|
|
285
|
+
n(this, "length");
|
|
286
|
+
n(this, "step");
|
|
287
|
+
this.value = t, this.length = r, this.step = i;
|
|
288
|
+
}
|
|
289
|
+
next() {
|
|
290
|
+
const t = this.value;
|
|
291
|
+
return this.value -= this.step, this.length-- ? f(!1, t) : l();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
class q {
|
|
295
|
+
constructor(t, r, i) {
|
|
296
|
+
n(this, "initialValue");
|
|
297
|
+
n(this, "length");
|
|
298
|
+
n(this, "step");
|
|
299
|
+
this.initialValue = t, this.length = r, this.step = i;
|
|
300
|
+
}
|
|
301
|
+
[Symbol.iterator]() {
|
|
302
|
+
return new W(this.initialValue, this.length, this.step);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
class W {
|
|
306
|
+
constructor(t, r, i) {
|
|
307
|
+
n(this, "value");
|
|
308
|
+
n(this, "length");
|
|
309
|
+
n(this, "step");
|
|
310
|
+
this.value = t, this.length = r, this.step = i;
|
|
311
|
+
}
|
|
312
|
+
next() {
|
|
313
|
+
return l();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function A(e, t, r) {
|
|
317
|
+
if (!m(r))
|
|
318
|
+
throw '"reducer" function must be provided';
|
|
319
|
+
const i = e[Symbol.iterator]();
|
|
320
|
+
let o = t, u = 0;
|
|
321
|
+
for (let s = i.next(); s.done !== !0; s = i.next())
|
|
322
|
+
o = r(o, s.value, u), u++;
|
|
323
|
+
return o;
|
|
324
|
+
}
|
|
325
|
+
function L(e, t) {
|
|
326
|
+
if (t < 0)
|
|
327
|
+
throw '"count" parameter must be greater or equal then 0';
|
|
328
|
+
return new tt(e, t);
|
|
329
|
+
}
|
|
330
|
+
class tt {
|
|
331
|
+
constructor(t, r) {
|
|
332
|
+
n(this, "value");
|
|
333
|
+
n(this, "count");
|
|
334
|
+
this.value = t, this.count = r;
|
|
335
|
+
}
|
|
336
|
+
[Symbol.iterator]() {
|
|
337
|
+
return new et(this.value, this.count);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
class et {
|
|
341
|
+
constructor(t, r) {
|
|
342
|
+
n(this, "leftToRepeat", 0);
|
|
343
|
+
n(this, "value");
|
|
344
|
+
n(this, "count");
|
|
345
|
+
n(this, "internalNext", () => this.leftToRepeat-- ? f(!1, this.value) : (this.internalNext = () => l(), l()));
|
|
346
|
+
this.value = t, this.count = r, this.leftToRepeat = r, r === 0 && (this.internalNext = () => l());
|
|
347
|
+
}
|
|
348
|
+
next() {
|
|
349
|
+
return this.internalNext();
|
|
350
|
+
}
|
|
351
|
+
return(t) {
|
|
352
|
+
return this.internalNext = () => l(), l(t);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function V(e, t) {
|
|
223
356
|
const r = e[Symbol.iterator]();
|
|
224
357
|
let i = 0;
|
|
225
|
-
for (let
|
|
226
|
-
if (t(
|
|
358
|
+
for (let o = r.next(); o.done !== !0; o = r.next())
|
|
359
|
+
if (t(o.value, i++))
|
|
227
360
|
return !0;
|
|
228
361
|
return !1;
|
|
229
362
|
}
|
|
230
|
-
|
|
363
|
+
function F(e, t) {
|
|
364
|
+
return new rt(e, t);
|
|
365
|
+
}
|
|
366
|
+
class rt {
|
|
367
|
+
constructor(t, r) {
|
|
368
|
+
n(this, "tapper");
|
|
369
|
+
n(this, "source");
|
|
370
|
+
this.source = t, this.tapper = r;
|
|
371
|
+
}
|
|
372
|
+
[Symbol.iterator]() {
|
|
373
|
+
return new nt(this.source, this.tapper);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
class nt {
|
|
377
|
+
constructor(t, r) {
|
|
378
|
+
n(this, "index", 0);
|
|
379
|
+
n(this, "sourceIterator");
|
|
380
|
+
n(this, "tapper");
|
|
381
|
+
n(this, "innerNext", () => {
|
|
382
|
+
const t = this.sourceIterator.next();
|
|
383
|
+
return t.done !== !0 ? (this.tapper(t.value, this.index++), t) : (this.innerNext = l, l());
|
|
384
|
+
});
|
|
385
|
+
this.sourceIterator = t[Symbol.iterator](), this.tapper = r;
|
|
386
|
+
}
|
|
387
|
+
next() {
|
|
388
|
+
return this.innerNext();
|
|
389
|
+
}
|
|
390
|
+
return(t) {
|
|
391
|
+
return this.innerNext = l, l(t);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function T(e, t) {
|
|
395
|
+
return new it(e, t);
|
|
396
|
+
}
|
|
397
|
+
class it {
|
|
398
|
+
constructor(t, r) {
|
|
399
|
+
n(this, "tapper");
|
|
400
|
+
n(this, "source");
|
|
401
|
+
this.source = t, this.tapper = r;
|
|
402
|
+
}
|
|
403
|
+
[Symbol.iterator]() {
|
|
404
|
+
return this.tapper(this.source, 0), this.source[Symbol.iterator]();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
408
|
+
__proto__: null,
|
|
409
|
+
collectToArray: $,
|
|
410
|
+
empty: w,
|
|
411
|
+
filter: v,
|
|
412
|
+
map: g,
|
|
413
|
+
materialize: z,
|
|
414
|
+
max: N,
|
|
415
|
+
memoize: M,
|
|
416
|
+
min: R,
|
|
417
|
+
range: k,
|
|
418
|
+
reduce: A,
|
|
419
|
+
repeat: L,
|
|
420
|
+
some: V,
|
|
421
|
+
tap: F,
|
|
422
|
+
tapChain: T
|
|
423
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
424
|
+
class d {
|
|
231
425
|
constructor(t) {
|
|
232
426
|
n(this, "iterable");
|
|
233
427
|
this.iterable = t;
|
|
@@ -236,31 +430,59 @@ class c {
|
|
|
236
430
|
return this.iterable[Symbol.iterator]();
|
|
237
431
|
}
|
|
238
432
|
collectToArray() {
|
|
239
|
-
return
|
|
433
|
+
return Array.from(this.iterable);
|
|
240
434
|
}
|
|
241
435
|
filter(t) {
|
|
242
|
-
return new
|
|
436
|
+
return new d(v(this.iterable, t));
|
|
243
437
|
}
|
|
244
438
|
map(t) {
|
|
245
|
-
return new
|
|
439
|
+
return new d(g(this.iterable, t));
|
|
246
440
|
}
|
|
247
441
|
materialize() {
|
|
248
|
-
return new
|
|
442
|
+
return new d(z(this.iterable));
|
|
443
|
+
}
|
|
444
|
+
max(t) {
|
|
445
|
+
return N(this.iterable, t);
|
|
249
446
|
}
|
|
250
447
|
memoize() {
|
|
251
|
-
return new
|
|
448
|
+
return new d(M(this.iterable));
|
|
252
449
|
}
|
|
253
450
|
min(t) {
|
|
254
|
-
return
|
|
451
|
+
return R(this.iterable, t);
|
|
452
|
+
}
|
|
453
|
+
reduce(t, r) {
|
|
454
|
+
return A(this.iterable, t, r);
|
|
255
455
|
}
|
|
256
456
|
some(t) {
|
|
257
|
-
return
|
|
457
|
+
return V(this.iterable, t);
|
|
458
|
+
}
|
|
459
|
+
tap(t) {
|
|
460
|
+
return new d(F(this.iterable, t));
|
|
461
|
+
}
|
|
462
|
+
tapChain(t) {
|
|
463
|
+
return new d(T(this.iterable, t));
|
|
464
|
+
}
|
|
465
|
+
tapChainCreation(t) {
|
|
466
|
+
return t(this), this;
|
|
258
467
|
}
|
|
259
468
|
}
|
|
260
|
-
function
|
|
261
|
-
return
|
|
469
|
+
function at() {
|
|
470
|
+
return b(w());
|
|
471
|
+
}
|
|
472
|
+
function b(e) {
|
|
473
|
+
return new d(e);
|
|
474
|
+
}
|
|
475
|
+
function ut(e, t, r, i) {
|
|
476
|
+
return b(k(e, t, r, i));
|
|
477
|
+
}
|
|
478
|
+
function lt(e, t) {
|
|
479
|
+
return b(L(e, t));
|
|
262
480
|
}
|
|
263
481
|
export {
|
|
264
|
-
|
|
265
|
-
|
|
482
|
+
ot as Functions,
|
|
483
|
+
d as IterableLinqWrapper,
|
|
484
|
+
at as empty,
|
|
485
|
+
b as from,
|
|
486
|
+
ut as fromRange,
|
|
487
|
+
lt as repeat
|
|
266
488
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(l,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(l=typeof globalThis<"u"?globalThis:l||self,c(l["interable-linq-utility"]={}))})(this,function(l){"use strict";var ut=Object.defineProperty;var lt=(l,c,m)=>c in l?ut(l,c,{enumerable:!0,configurable:!0,writable:!0,value:m}):l[c]=m;var n=(l,c,m)=>(lt(l,typeof c!="symbol"?c+"":c,m),m);function c(e){return Array.from(e)}function m(e,t){return{done:e,value:t}}function h(e){return{done:!0,value:e}}function ht(e){return e}function b(e){return typeof e=="function"}function S(){return new j}class j{[Symbol.iterator](){return new O}}class O{next(){return h()}return(t){return h(t)}}function w(e,t){if(!b(t))throw'"predicate" function must be provided';return new $(e,t)}class ${constructor(t,r){n(this,"predicate");n(this,"source");this.source=t,this.predicate=r}[Symbol.iterator](){return new P(this.source,this.predicate)}}class P{constructor(t,r){n(this,"index",0);n(this,"sourceIterator");n(this,"predicate");this.sourceIterator=t[Symbol.iterator](),this.predicate=r}next(){for(;;){const t=this.sourceIterator.next();if(t.done===!0||this.predicate(t.value,this.index++))return t}}}function v(e,t){if(!b(t))throw'"mapper" function must be provided';return new B(e,t)}class B{constructor(t,r){n(this,"mapper");n(this,"source");this.source=t,this.mapper=r}[Symbol.iterator](){return new D(this.source,this.mapper)}}class D{constructor(t,r){n(this,"index",0);n(this,"sourceIterator");n(this,"mapper");this.sourceIterator=t[Symbol.iterator](),this.mapper=r}next(){const t=this.sourceIterator.next();return t.done!==!0?m(!1,this.mapper(t.value,this.index++)):h()}}function G(e){const t=e[Symbol.iterator](),r=new I;for(let i=t.next();i.done!==!0;i=t.next())r.addLast(i.value);return r}class I{constructor(){n(this,"internalSize",0);n(this,"head",null);n(this,"tail",null);n(this,"internalAddFirst",t=>{const r={data:t,nextNode:null};return this.head=r,this.tail=r,this.internalSize++,this.internalAddFirst=i=>{const o={data:i,nextNode:null};return o.nextNode=this.head,this.head=o,this.internalSize++,this},this});n(this,"internalAddLast",t=>{const r={data:t,nextNode:null};return this.head=r,this.tail=r,this.internalSize++,this.internalAddLast=i=>{const o={data:i,nextNode:null};return this.tail.nextNode=o,this.tail=o,this.internalSize++,this},this})}[Symbol.iterator](){return new H(this.head)}addFirst(t){return this.internalAddFirst(t)}addLast(t){return this.internalAddLast(t)}size(){return this.internalSize}}class H{constructor(t=null){n(this,"current",null);this.current=t}next(){const t=this.current;return t===null?h():(this.current=t.nextNode,m(!1,t.data))}}function g(e){return e instanceof z?e:new z(e)}class z{constructor(t){n(this,"source");this.source=G(t)}[Symbol.iterator](){return new J(this.source)}}class J{constructor(t){n(this,"sourceIterator");this.sourceIterator=t[Symbol.iterator]()}next(){return this.sourceIterator.next()}}function M(e,t){const r=e[Symbol.iterator]();let i=r.next(),o=i.value,u=null;for(t==null?u=(s,a)=>s<a?-1:s===a?0:1:b(t)?u=t:Array.isArray(t)?u=(s,a)=>{let f=0;for(const d of t)if(f=s[d]<a[d]?-1:s[d]===a[d]?0:1,f!==0)break;return f}:u=(s,a)=>s[t]<a[t]?-1:s[t]===a[t]?0:1,i=r.next();i.done!==!0;i=r.next()){const s=u(o,i.value);o=s>0||s===0?o:i.value}return o==null?null:o}function N(e){return e instanceof R?e:new R(e)}class R{constructor(t){n(this,"isMemoized",!1);n(this,"sourceIterator");n(this,"linkedList",new I);n(this,"source");this.source=t,this.sourceIterator=t[Symbol.iterator](),t instanceof I&&(this.linkedList=t,this.isMemoized=!0)}[Symbol.iterator](){return this.isMemoized?new Q(this.linkedList):new K(this.sourceIterator,this.linkedList,t=>this.isMemoized=t.done===!0)}}class K{constructor(t,r,i){n(this,"index",0);n(this,"linkedList");n(this,"linkedListIterator");n(this,"setAsMemoized");n(this,"sourceIterator");this.linkedList=r,this.linkedListIterator=r[Symbol.iterator](),this.setAsMemoized=i,this.sourceIterator=t}next(){if(this.linkedList.size()>this.index++)return this.linkedListIterator.next();const t=this.sourceIterator.next();return this.setAsMemoized(t)||this.linkedList.addLast(t.value),t}}class Q{constructor(t){n(this,"memoizedSourceIterator");this.memoizedSourceIterator=t[Symbol.iterator]()}next(){return this.memoizedSourceIterator.next()}}function L(e,t){const r=e[Symbol.iterator]();let i=r.next(),o=i.value,u=null;for(t==null?u=(s,a)=>s<a?-1:s===a?0:1:b(t)?u=t:Array.isArray(t)?u=(s,a)=>{let f=0;for(const d of t)if(f=s[d]<a[d]?-1:s[d]===a[d]?0:1,f!==0)break;return f}:u=(s,a)=>s[t]<a[t]?-1:s[t]===a[t]?0:1,i=r.next();i.done!==!0;i=r.next()){const s=u(o,i.value);o=s<0||s===0?o:i.value}return o==null?null:o}function k(e,t,r,i){const o=t==null||t===!0||t===!1?e:t,u=t==null||t===!0||t===!1?0:e,s=u<o,a=r!==!0&&r!==!1&&r!=null&&r!==0?r:s?1:-1,f=s&&a<0||!s&&a>0?-1*a:a,d=Math.ceil(Math.abs(o-u)/Math.abs(f)),C=!!(t===!0||r===!0||i!=null&&i),y=C?d*f+u:u;return u===o?new _(y,0,0):C?new Y(y,d,f):new U(y,d,f)}class U{constructor(t,r,i){n(this,"initialValue");n(this,"length");n(this,"step");this.initialValue=t,this.length=r,this.step=i}[Symbol.iterator](){return new X(this.initialValue,this.length,this.step)}}class X{constructor(t,r,i){n(this,"value");n(this,"length");n(this,"step");this.value=t,this.length=r,this.step=i}next(){const t=this.value;return this.value+=this.step,this.length--?m(!1,t):h()}}class Y{constructor(t,r,i){n(this,"initialValue");n(this,"length");n(this,"step");this.initialValue=t-i,this.length=r,this.step=i}[Symbol.iterator](){return new Z(this.initialValue,this.length,this.step)}}class Z{constructor(t,r,i){n(this,"value");n(this,"length");n(this,"step");this.value=t,this.length=r,this.step=i}next(){const t=this.value;return this.value-=this.step,this.length--?m(!1,t):h()}}class _{constructor(t,r,i){n(this,"initialValue");n(this,"length");n(this,"step");this.initialValue=t,this.length=r,this.step=i}[Symbol.iterator](){return new q(this.initialValue,this.length,this.step)}}class q{constructor(t,r,i){n(this,"value");n(this,"length");n(this,"step");this.value=t,this.length=r,this.step=i}next(){return h()}}function A(e,t,r){if(!b(r))throw'"reducer" function must be provided';const i=e[Symbol.iterator]();let o=t,u=0;for(let s=i.next();s.done!==!0;s=i.next())o=r(o,s.value,u),u++;return o}function T(e,t){if(t<0)throw'"count" parameter must be greater or equal then 0';return new W(e,t)}class W{constructor(t,r){n(this,"value");n(this,"count");this.value=t,this.count=r}[Symbol.iterator](){return new tt(this.value,this.count)}}class tt{constructor(t,r){n(this,"leftToRepeat",0);n(this,"value");n(this,"count");n(this,"internalNext",()=>this.leftToRepeat--?m(!1,this.value):(this.internalNext=()=>h(),h()));this.value=t,this.count=r,this.leftToRepeat=r,r===0&&(this.internalNext=()=>h())}next(){return this.internalNext()}return(t){return this.internalNext=()=>h(),h(t)}}function V(e,t){const r=e[Symbol.iterator]();let i=0;for(let o=r.next();o.done!==!0;o=r.next())if(t(o.value,i++))return!0;return!1}function F(e,t){return new et(e,t)}class et{constructor(t,r){n(this,"tapper");n(this,"source");this.source=t,this.tapper=r}[Symbol.iterator](){return new rt(this.source,this.tapper)}}class rt{constructor(t,r){n(this,"index",0);n(this,"sourceIterator");n(this,"tapper");n(this,"innerNext",()=>{const t=this.sourceIterator.next();return t.done!==!0?(this.tapper(t.value,this.index++),t):(this.innerNext=h,h())});this.sourceIterator=t[Symbol.iterator](),this.tapper=r}next(){return this.innerNext()}return(t){return this.innerNext=h,h(t)}}function E(e,t){return new nt(e,t)}class nt{constructor(t,r){n(this,"tapper");n(this,"source");this.source=t,this.tapper=r}[Symbol.iterator](){return this.tapper(this.source,0),this.source[Symbol.iterator]()}}const it=Object.freeze(Object.defineProperty({__proto__:null,collectToArray:c,empty:S,filter:w,map:v,materialize:g,max:M,memoize:N,min:L,range:k,reduce:A,repeat:T,some:V,tap:F,tapChain:E},Symbol.toStringTag,{value:"Module"}));class p{constructor(t){n(this,"iterable");this.iterable=t}[Symbol.iterator](){return this.iterable[Symbol.iterator]()}collectToArray(){return Array.from(this.iterable)}filter(t){return new p(w(this.iterable,t))}map(t){return new p(v(this.iterable,t))}materialize(){return new p(g(this.iterable))}max(t){return M(this.iterable,t)}memoize(){return new p(N(this.iterable))}min(t){return L(this.iterable,t)}reduce(t,r){return A(this.iterable,t,r)}some(t){return V(this.iterable,t)}tap(t){return new p(F(this.iterable,t))}tapChain(t){return new p(E(this.iterable,t))}tapChainCreation(t){return t(this),this}}function st(){return x(S())}function x(e){return new p(e)}function ot(e,t,r,i){return x(k(e,t,r,i))}function at(e,t){return x(T(e,t))}l.Functions=it,l.IterableLinqWrapper=p,l.empty=st,l.from=x,l.fromRange=ot,l.repeat=at,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/linqIterable.d.ts
CHANGED
|
@@ -1,23 +1,38 @@
|
|
|
1
|
-
import { Comparer, Mapper, Predicate } from '@/types';
|
|
2
|
-
export interface
|
|
1
|
+
import { Comparer, Mapper, Reducer, Predicate, Tapper } from '@/types';
|
|
2
|
+
export interface IIterableLinq<T> {
|
|
3
3
|
[Symbol.iterator](): Iterator<T, any, undefined>;
|
|
4
4
|
collectToArray(): T[];
|
|
5
|
-
filter(predicate: Predicate<T>):
|
|
6
|
-
map<R>(mapper: Mapper<T, R>):
|
|
7
|
-
materialize():
|
|
8
|
-
|
|
5
|
+
filter(predicate: Predicate<T>): IIterableLinq<T>;
|
|
6
|
+
map<R>(mapper: Mapper<T, R>): IIterableLinq<R>;
|
|
7
|
+
materialize(): IIterableLinq<T>;
|
|
8
|
+
max(comparer?: Comparer<T>): T | null | undefined;
|
|
9
|
+
memoize(): IIterableLinq<T>;
|
|
9
10
|
min(comparer?: Comparer<T>): T | null | undefined;
|
|
11
|
+
reduce<R>(neutralElement: R, reducer: Reducer<T, R>): R;
|
|
10
12
|
some(predicate: Predicate<T>): boolean;
|
|
13
|
+
tap(tapper: Tapper<T>): IIterableLinq<T>;
|
|
14
|
+
tapChain(tapper: Tapper<Iterable<T>>): IIterableLinq<T>;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @operation `Tap`
|
|
18
|
+
* @param chainCreationTapper
|
|
19
|
+
*/
|
|
20
|
+
tapChainCreation(chainCreationTapper: (iterableLinqWrapper: IIterableLinq<T>) => void): IIterableLinq<T>;
|
|
11
21
|
}
|
|
12
|
-
export declare class
|
|
22
|
+
export declare class IterableLinqWrapper<T> implements IIterableLinq<T> {
|
|
13
23
|
constructor(iterable: Iterable<T>);
|
|
14
24
|
[Symbol.iterator](): Iterator<T, any, undefined>;
|
|
15
25
|
private iterable;
|
|
16
26
|
collectToArray(): T[];
|
|
17
|
-
filter(predicate: Predicate<T>):
|
|
18
|
-
map<R>(mapper: Mapper<T, R>):
|
|
19
|
-
materialize():
|
|
20
|
-
|
|
27
|
+
filter(predicate: Predicate<T>): IIterableLinq<T>;
|
|
28
|
+
map<R>(mapper: Mapper<T, R>): IIterableLinq<R>;
|
|
29
|
+
materialize(): IIterableLinq<T>;
|
|
30
|
+
max(comparer?: Comparer<T>): T | null | undefined;
|
|
31
|
+
memoize(): IIterableLinq<T>;
|
|
21
32
|
min(comparer?: Comparer<T>): T | null | undefined;
|
|
33
|
+
reduce<R>(neutralElement: R, reducer: Reducer<T, R>): R;
|
|
22
34
|
some(predicate: Predicate<T>): boolean;
|
|
35
|
+
tap(tapper: Tapper<T>): IIterableLinq<T>;
|
|
36
|
+
tapChain(tapper: Tapper<Iterable<T>>): IIterableLinq<T>;
|
|
37
|
+
tapChainCreation(chainCreationTapper: (iterableLinqWrapper: IIterableLinq<T>) => void): IIterableLinq<T>;
|
|
23
38
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type Reducer<T, R> = (acc: R, value: T, index: number) => R;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type Tapper<T> = (value: T, index: number) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function getIteratorResult<T>(done: boolean, value?: T): IteratorResult<T>;
|
|
2
|
-
export declare function getDoneIteratorResult<T>(): IteratorResult<T>;
|
|
2
|
+
export declare function getDoneIteratorResult<T>(value?: T): IteratorResult<T>;
|
|
3
3
|
export declare function getFlatIteratorResult<T>(result: IteratorResult<T>): IteratorResult<T>;
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
export declare type BooleanComparePredicate<T> = (current: T, other: T) => boolean;
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @since 1.0.0
|
|
5
|
-
* @param {*} value The value to check.
|
|
6
|
-
* @returns {boolean} Returns `true` if `value` is `null`, `undefined` or `NaN`, else false.
|
|
7
|
-
* @example
|
|
8
|
-
*
|
|
9
|
-
* isNullOrUndefined(null)
|
|
10
|
-
* // => true
|
|
11
|
-
*
|
|
12
|
-
* isNullOrUndefined(undefined)
|
|
13
|
-
* // => true
|
|
14
|
-
*
|
|
15
|
-
* isNullOrUndefined()
|
|
16
|
-
* // => true
|
|
17
|
-
*
|
|
18
|
-
* const myVariable = undefined
|
|
19
|
-
* isNullOrUndefined(myVariable)
|
|
20
|
-
* // => true
|
|
21
|
-
*
|
|
22
|
-
* isNullOrUndefined('')
|
|
23
|
-
* // => false
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
export declare function isNullOrUndefined(value?: any): value is null | undefined;
|
|
27
1
|
/**
|
|
28
2
|
* Checks if `value` is classified as a `Function` object.
|
|
29
3
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iterable-linq-utility",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "An Iterable mutation utility inspired by .net Linq and Javascript Array interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/interable-linq-utility.umd.cjs",
|
|
@@ -29,17 +29,22 @@
|
|
|
29
29
|
"url": "git+https://github.com/Amebus/iterable-linq-utility.git"
|
|
30
30
|
},
|
|
31
31
|
"author": "Amebus",
|
|
32
|
-
"license": "
|
|
32
|
+
"license": "MIT",
|
|
33
33
|
"bugs": {
|
|
34
34
|
"url": "https://github.com/Amebus/iterable-linq-utility/issues"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/Amebus/iterable-linq-utility#readme",
|
|
37
|
-
"keywords": [
|
|
37
|
+
"keywords": [
|
|
38
|
+
"linq",
|
|
39
|
+
"itearable",
|
|
40
|
+
"utility"
|
|
41
|
+
],
|
|
38
42
|
"devDependencies": {
|
|
39
|
-
"@rushstack/eslint-patch": "
|
|
43
|
+
"@rushstack/eslint-patch": "1.1.4",
|
|
40
44
|
"@types/node": "18.11.10",
|
|
41
45
|
"@typescript-eslint/eslint-plugin": "5.36.2",
|
|
42
46
|
"@typescript-eslint/parser": "5.36.2",
|
|
47
|
+
"@vitest/coverage-c8": "0.25.8",
|
|
43
48
|
"@vitest/ui": "0.25.2",
|
|
44
49
|
"eslint": "8.22.0",
|
|
45
50
|
"eslint-plugin-import": "2.26.0",
|