iterable-linq-utility 0.3.0 → 0.5.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 +8 -5
- package/dist/index.d.cts +373 -1
- package/dist/index.d.ts +373 -1
- package/dist/iterable-linq-utility.js +270 -119
- package/dist/iterable-linq-utility.umd.cjs +1 -1
- package/package.json +3 -1
|
@@ -71,13 +71,27 @@ function ne(e, t) {
|
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/functions/collectToArray.ts
|
|
74
|
-
function
|
|
74
|
+
function re(e) {
|
|
75
75
|
if (c(e), Array.isArray(e) || e instanceof Set) return Array.from(e);
|
|
76
76
|
let t = [];
|
|
77
77
|
for (let n of e) t.push(n);
|
|
78
78
|
return t;
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
|
+
//#region src/functions/count.ts
|
|
82
|
+
function d(e, t) {
|
|
83
|
+
c(e);
|
|
84
|
+
let n = 0;
|
|
85
|
+
if (t === void 0) {
|
|
86
|
+
for (let t of e) n++;
|
|
87
|
+
return n;
|
|
88
|
+
}
|
|
89
|
+
l(t, "predicate");
|
|
90
|
+
let r = 0;
|
|
91
|
+
for (let i of e) t(i, r++) && n++;
|
|
92
|
+
return n;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
81
95
|
//#region src/iterators/baseIterator.ts
|
|
82
96
|
var f = class {
|
|
83
97
|
done = !1;
|
|
@@ -122,9 +136,9 @@ var f = class {
|
|
|
122
136
|
//#endregion
|
|
123
137
|
//#region src/iterators/unfold.ts
|
|
124
138
|
function h(e, t) {
|
|
125
|
-
return new p(() => new
|
|
139
|
+
return new p(() => new ie(e, t));
|
|
126
140
|
}
|
|
127
|
-
var
|
|
141
|
+
var ie = class extends f {
|
|
128
142
|
state;
|
|
129
143
|
step;
|
|
130
144
|
constructor(e, t) {
|
|
@@ -136,16 +150,48 @@ var g = class extends f {
|
|
|
136
150
|
}
|
|
137
151
|
};
|
|
138
152
|
//#endregion
|
|
153
|
+
//#region src/functions/distinct.ts
|
|
154
|
+
function g(e, t) {
|
|
155
|
+
return c(e), t !== void 0 && l(t, "keySelector"), new p(() => new ae(e, t));
|
|
156
|
+
}
|
|
157
|
+
var ae = class extends m {
|
|
158
|
+
keySelector;
|
|
159
|
+
seen = /* @__PURE__ */ new Set();
|
|
160
|
+
constructor(e, t) {
|
|
161
|
+
super(e), this.keySelector = t;
|
|
162
|
+
}
|
|
163
|
+
advance() {
|
|
164
|
+
for (let e = this.source.next();; e = this.source.next()) {
|
|
165
|
+
if (e.done === !0) return e;
|
|
166
|
+
let t = e.value;
|
|
167
|
+
if (this.keySelector !== void 0) try {
|
|
168
|
+
t = this.keySelector(e.value, this.index++);
|
|
169
|
+
} catch (e) {
|
|
170
|
+
throw this.closeAfterCallbackError(), e;
|
|
171
|
+
}
|
|
172
|
+
if (!this.seen.has(t)) return this.seen.add(t), e;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
//#endregion
|
|
139
177
|
//#region src/functions/empty.ts
|
|
140
178
|
function _() {
|
|
141
179
|
return h(void 0, () => void 0);
|
|
142
180
|
}
|
|
143
181
|
//#endregion
|
|
144
|
-
//#region src/functions/
|
|
182
|
+
//#region src/functions/every.ts
|
|
145
183
|
function v(e, t) {
|
|
146
|
-
|
|
184
|
+
c(e), l(t, "predicate");
|
|
185
|
+
let n = 0;
|
|
186
|
+
for (let r of e) if (!t(r, n++)) return !1;
|
|
187
|
+
return !0;
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/functions/filter.ts
|
|
191
|
+
function oe(e, t) {
|
|
192
|
+
return c(e), l(t, "predicate"), new p(() => new se(e, t));
|
|
147
193
|
}
|
|
148
|
-
var
|
|
194
|
+
var se = class extends m {
|
|
149
195
|
predicate;
|
|
150
196
|
constructor(e, t) {
|
|
151
197
|
super(e), this.predicate = t;
|
|
@@ -164,11 +210,29 @@ var re = class extends m {
|
|
|
164
210
|
}
|
|
165
211
|
};
|
|
166
212
|
//#endregion
|
|
167
|
-
//#region src/functions/
|
|
213
|
+
//#region src/functions/find.ts
|
|
168
214
|
function y(e, t) {
|
|
169
|
-
|
|
215
|
+
c(e), l(t, "predicate");
|
|
216
|
+
let n = 0;
|
|
217
|
+
for (let r of e) if (t(r, n++)) return r;
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/functions/findIndex.ts
|
|
221
|
+
function b(e, t) {
|
|
222
|
+
c(e), l(t, "predicate");
|
|
223
|
+
let n = 0;
|
|
224
|
+
for (let r of e) {
|
|
225
|
+
if (t(r, n)) return n;
|
|
226
|
+
n++;
|
|
227
|
+
}
|
|
228
|
+
return -1;
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/functions/flatMap.ts
|
|
232
|
+
function x(e, t) {
|
|
233
|
+
return c(e), l(t, "mapper"), new p(() => new ce(e, t));
|
|
170
234
|
}
|
|
171
|
-
var
|
|
235
|
+
var ce = class e extends m {
|
|
172
236
|
mapper;
|
|
173
237
|
static steps = {
|
|
174
238
|
outer: (t) => {
|
|
@@ -229,7 +293,7 @@ var ie = class e extends m {
|
|
|
229
293
|
throw e.inner = void 0, e.closeAfterCallbackError(), t;
|
|
230
294
|
}
|
|
231
295
|
}
|
|
232
|
-
},
|
|
296
|
+
}, S = class e {
|
|
233
297
|
static instance = e.createFrozen();
|
|
234
298
|
constructor() {}
|
|
235
299
|
static createFrozen() {
|
|
@@ -237,29 +301,37 @@ var ie = class e extends m {
|
|
|
237
301
|
return Object.freeze(t), t;
|
|
238
302
|
}
|
|
239
303
|
};
|
|
240
|
-
function
|
|
241
|
-
return
|
|
304
|
+
function C() {
|
|
305
|
+
return S.instance;
|
|
242
306
|
}
|
|
243
307
|
//#endregion
|
|
244
308
|
//#region src/functions/forEach.ts
|
|
245
|
-
function
|
|
309
|
+
function w(e, t) {
|
|
246
310
|
c(e), l(t, "action");
|
|
247
311
|
let n = 0;
|
|
248
312
|
for (let r of e) t(r, n++);
|
|
249
|
-
return
|
|
313
|
+
return C();
|
|
250
314
|
}
|
|
251
|
-
async function
|
|
315
|
+
async function T(e, t) {
|
|
252
316
|
c(e), l(t, "action");
|
|
253
317
|
let n = 0;
|
|
254
318
|
for (let r of e) await t(r, n++);
|
|
255
|
-
return
|
|
319
|
+
return C();
|
|
320
|
+
}
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/functions/includes.ts
|
|
323
|
+
function E(e, t) {
|
|
324
|
+
c(e);
|
|
325
|
+
let n = t !== t;
|
|
326
|
+
for (let r of e) if (r === t || n && r !== r) return !0;
|
|
327
|
+
return !1;
|
|
256
328
|
}
|
|
257
329
|
//#endregion
|
|
258
330
|
//#region src/functions/map.ts
|
|
259
|
-
function
|
|
260
|
-
return c(e), l(t, "mapper"), new p(() => new
|
|
331
|
+
function D(e, t) {
|
|
332
|
+
return c(e), l(t, "mapper"), new p(() => new le(e, t));
|
|
261
333
|
}
|
|
262
|
-
var
|
|
334
|
+
var le = class extends m {
|
|
263
335
|
mapper;
|
|
264
336
|
constructor(e, t) {
|
|
265
337
|
super(e), this.mapper = t;
|
|
@@ -278,18 +350,18 @@ var ae = class extends m {
|
|
|
278
350
|
};
|
|
279
351
|
//#endregion
|
|
280
352
|
//#region src/collections/linkedList.ts
|
|
281
|
-
function
|
|
353
|
+
function ue(e) {
|
|
282
354
|
c(e);
|
|
283
|
-
let t = new
|
|
355
|
+
let t = new de();
|
|
284
356
|
for (let n of e) t.addLast(n);
|
|
285
357
|
return t;
|
|
286
358
|
}
|
|
287
|
-
var
|
|
359
|
+
var de = class {
|
|
288
360
|
internalSize = 0;
|
|
289
361
|
head = null;
|
|
290
362
|
tail = null;
|
|
291
363
|
[Symbol.iterator]() {
|
|
292
|
-
return new
|
|
364
|
+
return new fe(this.head);
|
|
293
365
|
}
|
|
294
366
|
addFirst(e) {
|
|
295
367
|
let t = {
|
|
@@ -308,7 +380,7 @@ var oe = class {
|
|
|
308
380
|
size() {
|
|
309
381
|
return this.internalSize;
|
|
310
382
|
}
|
|
311
|
-
},
|
|
383
|
+
}, fe = class extends f {
|
|
312
384
|
current;
|
|
313
385
|
constructor(e) {
|
|
314
386
|
super(), this.current = e;
|
|
@@ -320,13 +392,13 @@ var oe = class {
|
|
|
320
392
|
};
|
|
321
393
|
//#endregion
|
|
322
394
|
//#region src/functions/materialize.ts
|
|
323
|
-
function
|
|
324
|
-
return c(e), e instanceof
|
|
395
|
+
function O(e) {
|
|
396
|
+
return c(e), e instanceof k ? e : new k(e);
|
|
325
397
|
}
|
|
326
|
-
var
|
|
398
|
+
var k = class {
|
|
327
399
|
source;
|
|
328
400
|
constructor(e) {
|
|
329
|
-
this.source =
|
|
401
|
+
this.source = ue(e);
|
|
330
402
|
}
|
|
331
403
|
[Symbol.iterator]() {
|
|
332
404
|
return this.source[Symbol.iterator]();
|
|
@@ -334,29 +406,29 @@ var D = class {
|
|
|
334
406
|
};
|
|
335
407
|
//#endregion
|
|
336
408
|
//#region src/functions/max.ts
|
|
337
|
-
function
|
|
409
|
+
function A(e, t) {
|
|
338
410
|
return c(e), a(e, i(t), 1);
|
|
339
411
|
}
|
|
340
412
|
//#endregion
|
|
341
413
|
//#region src/functions/memoize.ts
|
|
342
|
-
function
|
|
414
|
+
function j() {
|
|
343
415
|
return { allowPartialMemoization: !0 };
|
|
344
416
|
}
|
|
345
|
-
function
|
|
417
|
+
function M(e, t) {
|
|
346
418
|
c(e);
|
|
347
419
|
let n = {
|
|
348
|
-
...
|
|
420
|
+
...j(),
|
|
349
421
|
...t
|
|
350
422
|
}.allowPartialMemoization;
|
|
351
|
-
return e instanceof
|
|
423
|
+
return e instanceof P ? n ? e.changePartialMemoizationBehaviour() : e : e instanceof F ? n ? e : e.changePartialMemoizationBehaviour() : n ? new F(e) : new P(e);
|
|
352
424
|
}
|
|
353
|
-
function
|
|
425
|
+
function N() {
|
|
354
426
|
return {
|
|
355
427
|
values: [],
|
|
356
428
|
finished: !1
|
|
357
429
|
};
|
|
358
430
|
}
|
|
359
|
-
function
|
|
431
|
+
function pe(e, t) {
|
|
360
432
|
if (t.error) throw t.error.value;
|
|
361
433
|
if (t.finished) return !1;
|
|
362
434
|
t.source ??= e[Symbol.iterator]();
|
|
@@ -368,31 +440,31 @@ function M(e, t) {
|
|
|
368
440
|
}
|
|
369
441
|
return n.done === !0 ? (t.finished = !0, t.source = void 0, !1) : (t.values.push(n.value), !0);
|
|
370
442
|
}
|
|
371
|
-
var
|
|
443
|
+
var P = class {
|
|
372
444
|
source;
|
|
373
|
-
cache =
|
|
445
|
+
cache = N();
|
|
374
446
|
constructor(e) {
|
|
375
447
|
this.source = e;
|
|
376
448
|
}
|
|
377
449
|
[Symbol.iterator]() {
|
|
378
|
-
return new
|
|
450
|
+
return new I(this.source, this.cache, !0);
|
|
379
451
|
}
|
|
380
452
|
changePartialMemoizationBehaviour() {
|
|
381
|
-
return new
|
|
453
|
+
return new F(this.source);
|
|
382
454
|
}
|
|
383
|
-
},
|
|
455
|
+
}, F = class {
|
|
384
456
|
source;
|
|
385
|
-
cache =
|
|
457
|
+
cache = N();
|
|
386
458
|
constructor(e) {
|
|
387
459
|
this.source = e;
|
|
388
460
|
}
|
|
389
461
|
[Symbol.iterator]() {
|
|
390
|
-
return new
|
|
462
|
+
return new I(this.source, this.cache, !1);
|
|
391
463
|
}
|
|
392
464
|
changePartialMemoizationBehaviour() {
|
|
393
|
-
return new
|
|
465
|
+
return new P(this.source);
|
|
394
466
|
}
|
|
395
|
-
},
|
|
467
|
+
}, I = class extends f {
|
|
396
468
|
source;
|
|
397
469
|
cache;
|
|
398
470
|
drainFirst;
|
|
@@ -401,28 +473,28 @@ var N = class {
|
|
|
401
473
|
super(), this.source = e, this.cache = t, this.drainFirst = n;
|
|
402
474
|
}
|
|
403
475
|
advance() {
|
|
404
|
-
if (this.drainFirst) for (;
|
|
405
|
-
return this.index < this.cache.values.length ||
|
|
476
|
+
if (this.drainFirst) for (; pe(this.source, this.cache););
|
|
477
|
+
return this.index < this.cache.values.length || pe(this.source, this.cache) ? o(this.cache.values[this.index++]) : s();
|
|
406
478
|
}
|
|
407
479
|
};
|
|
408
480
|
//#endregion
|
|
409
481
|
//#region src/functions/min.ts
|
|
410
|
-
function
|
|
482
|
+
function L(e, t) {
|
|
411
483
|
return c(e), a(e, i(t), -1);
|
|
412
484
|
}
|
|
413
485
|
//#endregion
|
|
414
486
|
//#region src/functions/range.ts
|
|
415
|
-
function
|
|
487
|
+
function R(e, t, n) {
|
|
416
488
|
let r = typeof t == "number", i = r ? e : 0, a = r ? t : e;
|
|
417
489
|
if (!r && n !== void 0) throw Error("The \"options\" parameter must be the second argument when \"start\" is omitted");
|
|
418
490
|
let o = r ? n : t;
|
|
419
491
|
o !== void 0 && te(o, "options");
|
|
420
492
|
let { step: s = 1, reverse: c = !1 } = o ?? {};
|
|
421
493
|
ee(s, "step");
|
|
422
|
-
let l =
|
|
423
|
-
return l.length > 0 ? new p(() => new
|
|
494
|
+
let l = me(i, a, Math.abs(s), c);
|
|
495
|
+
return l.length > 0 ? new p(() => new he(l.first, l.step, l.length)) : _();
|
|
424
496
|
}
|
|
425
|
-
function
|
|
497
|
+
function me(e, t, n, r) {
|
|
426
498
|
let i = t < e ? -n : n, a = Math.ceil(Math.abs(t - e) / n);
|
|
427
499
|
return r ? {
|
|
428
500
|
first: e + (a - 1) * i,
|
|
@@ -434,7 +506,7 @@ function ce(e, t, n, r) {
|
|
|
434
506
|
length: a
|
|
435
507
|
};
|
|
436
508
|
}
|
|
437
|
-
var
|
|
509
|
+
var he = class extends f {
|
|
438
510
|
first;
|
|
439
511
|
step;
|
|
440
512
|
length;
|
|
@@ -448,15 +520,15 @@ var le = class extends f {
|
|
|
448
520
|
};
|
|
449
521
|
//#endregion
|
|
450
522
|
//#region src/functions/reduce.ts
|
|
451
|
-
function
|
|
452
|
-
if (c(e), t.length === 1) return
|
|
523
|
+
function z(e, ...t) {
|
|
524
|
+
if (c(e), t.length === 1) return ge(e, t[0]);
|
|
453
525
|
let [n, r] = t;
|
|
454
526
|
l(r, "reducer");
|
|
455
527
|
let i = n, a = 0;
|
|
456
528
|
for (let t of e) i = r(i, t, a++);
|
|
457
529
|
return i;
|
|
458
530
|
}
|
|
459
|
-
function
|
|
531
|
+
function ge(e, t) {
|
|
460
532
|
l(t, "reducer");
|
|
461
533
|
let n, r = 0;
|
|
462
534
|
for (let i of e) n = r === 0 ? i : t(n, i, r), r++;
|
|
@@ -471,9 +543,9 @@ function B(e, t) {
|
|
|
471
543
|
//#endregion
|
|
472
544
|
//#region src/functions/skip.ts
|
|
473
545
|
function V(e, t) {
|
|
474
|
-
return c(e), u(t, "count"), new p(() => new
|
|
546
|
+
return c(e), u(t, "count"), new p(() => new _e(e, t));
|
|
475
547
|
}
|
|
476
|
-
var
|
|
548
|
+
var _e = class extends m {
|
|
477
549
|
count;
|
|
478
550
|
constructor(e, t) {
|
|
479
551
|
super(e), this.count = t;
|
|
@@ -488,6 +560,31 @@ var H = class extends m {
|
|
|
488
560
|
}
|
|
489
561
|
};
|
|
490
562
|
//#endregion
|
|
563
|
+
//#region src/functions/skipWhile.ts
|
|
564
|
+
function H(e, t) {
|
|
565
|
+
return c(e), l(t, "predicate"), new p(() => new ve(e, t));
|
|
566
|
+
}
|
|
567
|
+
var ve = class extends m {
|
|
568
|
+
predicate;
|
|
569
|
+
skipping = !0;
|
|
570
|
+
constructor(e, t) {
|
|
571
|
+
super(e), this.predicate = t;
|
|
572
|
+
}
|
|
573
|
+
advance() {
|
|
574
|
+
if (!this.skipping) return this.source.next();
|
|
575
|
+
for (let e = this.source.next();; e = this.source.next()) {
|
|
576
|
+
if (e.done === !0) return e;
|
|
577
|
+
let t;
|
|
578
|
+
try {
|
|
579
|
+
t = this.predicate(e.value, this.index++);
|
|
580
|
+
} catch (e) {
|
|
581
|
+
throw this.closeAfterCallbackError(), e;
|
|
582
|
+
}
|
|
583
|
+
if (!t) return this.skipping = !1, e;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
//#endregion
|
|
491
588
|
//#region src/functions/some.ts
|
|
492
589
|
function U(e, t) {
|
|
493
590
|
if (c(e), t === void 0) {
|
|
@@ -502,9 +599,9 @@ function U(e, t) {
|
|
|
502
599
|
//#endregion
|
|
503
600
|
//#region src/functions/take.ts
|
|
504
601
|
function W(e, t) {
|
|
505
|
-
return c(e), u(t, "count"), new p(() => new
|
|
602
|
+
return c(e), u(t, "count"), new p(() => new ye(e, t));
|
|
506
603
|
}
|
|
507
|
-
var
|
|
604
|
+
var ye = class extends m {
|
|
508
605
|
count;
|
|
509
606
|
constructor(e, t) {
|
|
510
607
|
super(e), this.count = t;
|
|
@@ -516,11 +613,33 @@ var ue = class extends m {
|
|
|
516
613
|
}
|
|
517
614
|
};
|
|
518
615
|
//#endregion
|
|
519
|
-
//#region src/functions/
|
|
616
|
+
//#region src/functions/takeWhile.ts
|
|
520
617
|
function G(e, t) {
|
|
521
|
-
return c(e), l(t, "
|
|
618
|
+
return c(e), l(t, "predicate"), new p(() => new be(e, t));
|
|
619
|
+
}
|
|
620
|
+
var be = class extends m {
|
|
621
|
+
predicate;
|
|
622
|
+
constructor(e, t) {
|
|
623
|
+
super(e), this.predicate = t;
|
|
624
|
+
}
|
|
625
|
+
advance() {
|
|
626
|
+
let e = this.source.next();
|
|
627
|
+
if (e.done === !0) return e;
|
|
628
|
+
let t;
|
|
629
|
+
try {
|
|
630
|
+
t = this.predicate(e.value, this.index++);
|
|
631
|
+
} catch (e) {
|
|
632
|
+
throw this.closeAfterCallbackError(), e;
|
|
633
|
+
}
|
|
634
|
+
return t ? e : (this.source.return?.(), s());
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region src/functions/tap.ts
|
|
639
|
+
function K(e, t) {
|
|
640
|
+
return c(e), l(t, "tapper"), new p(() => new xe(e, t));
|
|
522
641
|
}
|
|
523
|
-
var
|
|
642
|
+
var xe = class extends m {
|
|
524
643
|
tapper;
|
|
525
644
|
constructor(e, t) {
|
|
526
645
|
super(e), this.tapper = t;
|
|
@@ -538,39 +657,47 @@ var de = class extends m {
|
|
|
538
657
|
};
|
|
539
658
|
//#endregion
|
|
540
659
|
//#region src/functions/tapChain.ts
|
|
541
|
-
function
|
|
660
|
+
function q(e, t) {
|
|
542
661
|
return c(e), l(t, "tapper"), new p(() => (t(e, 0), e[Symbol.iterator]()));
|
|
543
662
|
}
|
|
544
663
|
//#endregion
|
|
545
664
|
//#region src/functions/index.ts
|
|
546
|
-
var
|
|
547
|
-
collectToArray: () =>
|
|
665
|
+
var Se = /* @__PURE__ */ t({
|
|
666
|
+
collectToArray: () => re,
|
|
667
|
+
count: () => d,
|
|
668
|
+
distinct: () => g,
|
|
548
669
|
empty: () => _,
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
670
|
+
every: () => v,
|
|
671
|
+
filter: () => oe,
|
|
672
|
+
find: () => y,
|
|
673
|
+
findIndex: () => b,
|
|
674
|
+
flatMap: () => x,
|
|
675
|
+
forEach: () => w,
|
|
676
|
+
forEachAsync: () => T,
|
|
677
|
+
getMemoizeDefaultOptions: () => j,
|
|
678
|
+
includes: () => E,
|
|
679
|
+
map: () => D,
|
|
680
|
+
materialize: () => O,
|
|
681
|
+
max: () => A,
|
|
682
|
+
memoize: () => M,
|
|
683
|
+
min: () => L,
|
|
684
|
+
range: () => R,
|
|
685
|
+
reduce: () => z,
|
|
561
686
|
repeat: () => B,
|
|
562
687
|
skip: () => V,
|
|
688
|
+
skipWhile: () => H,
|
|
563
689
|
some: () => U,
|
|
564
690
|
take: () => W,
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
691
|
+
takeWhile: () => G,
|
|
692
|
+
tap: () => K,
|
|
693
|
+
tapChain: () => q
|
|
694
|
+
}), J = Symbol.for("iterable-linq-utility.IIterableLinq");
|
|
568
695
|
//#endregion
|
|
569
696
|
//#region src/linqIterable.ts
|
|
570
|
-
function
|
|
571
|
-
return new
|
|
697
|
+
function Y(e) {
|
|
698
|
+
return new X(e);
|
|
572
699
|
}
|
|
573
|
-
var
|
|
700
|
+
var X = class {
|
|
574
701
|
iterable;
|
|
575
702
|
constructor(e) {
|
|
576
703
|
this.iterable = e;
|
|
@@ -579,52 +706,76 @@ var Y = class {
|
|
|
579
706
|
return this.iterable[Symbol.iterator]();
|
|
580
707
|
}
|
|
581
708
|
collectToArray() {
|
|
582
|
-
return
|
|
709
|
+
return re(this.iterable);
|
|
710
|
+
}
|
|
711
|
+
count(e) {
|
|
712
|
+
return d(this.iterable, e);
|
|
713
|
+
}
|
|
714
|
+
distinct(e) {
|
|
715
|
+
return Y(g(this.iterable, e));
|
|
716
|
+
}
|
|
717
|
+
every(e) {
|
|
718
|
+
return v(this.iterable, e);
|
|
583
719
|
}
|
|
584
720
|
filter(e) {
|
|
585
|
-
return
|
|
721
|
+
return Y(oe(this.iterable, e));
|
|
722
|
+
}
|
|
723
|
+
find(e) {
|
|
724
|
+
return y(this.iterable, e);
|
|
725
|
+
}
|
|
726
|
+
findIndex(e) {
|
|
727
|
+
return b(this.iterable, e);
|
|
586
728
|
}
|
|
587
729
|
flatMap(e) {
|
|
588
|
-
return
|
|
730
|
+
return Y(x(this.iterable, e));
|
|
589
731
|
}
|
|
590
732
|
forEach(e) {
|
|
591
|
-
return
|
|
733
|
+
return w(this.iterable, e);
|
|
592
734
|
}
|
|
593
735
|
forEachAsync(e) {
|
|
594
|
-
return
|
|
736
|
+
return T(this.iterable, e);
|
|
737
|
+
}
|
|
738
|
+
includes(e) {
|
|
739
|
+
return E(this.iterable, e);
|
|
595
740
|
}
|
|
596
741
|
map(e) {
|
|
597
|
-
return
|
|
742
|
+
return Y(D(this.iterable, e));
|
|
598
743
|
}
|
|
599
744
|
materialize() {
|
|
600
|
-
return
|
|
745
|
+
return Y(O(this.iterable));
|
|
601
746
|
}
|
|
602
747
|
max(e) {
|
|
603
|
-
return
|
|
748
|
+
return A(this.iterable, e);
|
|
604
749
|
}
|
|
605
750
|
memoize(e) {
|
|
606
|
-
return
|
|
751
|
+
return Y(M(this.iterable, e));
|
|
607
752
|
}
|
|
608
753
|
min(e) {
|
|
609
|
-
return
|
|
754
|
+
return L(this.iterable, e);
|
|
610
755
|
}
|
|
611
756
|
reduce(...e) {
|
|
612
|
-
return e.length === 1 ?
|
|
757
|
+
return e.length === 1 ? z(this.iterable, e[0]) : z(this.iterable, e[0], e[1]);
|
|
613
758
|
}
|
|
614
759
|
skip(e) {
|
|
615
|
-
return
|
|
760
|
+
return Y(V(this.iterable, e));
|
|
761
|
+
}
|
|
762
|
+
skipWhile(e) {
|
|
763
|
+
return Y(H(this.iterable, e));
|
|
616
764
|
}
|
|
617
765
|
some(e) {
|
|
618
766
|
return U(this.iterable, e);
|
|
619
767
|
}
|
|
620
768
|
take(e) {
|
|
621
|
-
return
|
|
769
|
+
return Y(W(this.iterable, e));
|
|
770
|
+
}
|
|
771
|
+
takeWhile(e) {
|
|
772
|
+
return Y(G(this.iterable, e));
|
|
622
773
|
}
|
|
623
774
|
tap(e) {
|
|
624
|
-
return
|
|
775
|
+
return Y(K(this.iterable, e));
|
|
625
776
|
}
|
|
626
777
|
tapChain(e) {
|
|
627
|
-
return
|
|
778
|
+
return Y(q(this.iterable, e));
|
|
628
779
|
}
|
|
629
780
|
tapChainCreation(e) {
|
|
630
781
|
l(e, "chainCreationTapper");
|
|
@@ -632,7 +783,7 @@ var Y = class {
|
|
|
632
783
|
return e(t), t;
|
|
633
784
|
}
|
|
634
785
|
};
|
|
635
|
-
Object.defineProperty(
|
|
786
|
+
Object.defineProperty(X.prototype, J, {
|
|
636
787
|
value: !0,
|
|
637
788
|
enumerable: !1,
|
|
638
789
|
writable: !1,
|
|
@@ -640,15 +791,15 @@ Object.defineProperty(Y.prototype, q, {
|
|
|
640
791
|
});
|
|
641
792
|
//#endregion
|
|
642
793
|
//#region src/extension.ts
|
|
643
|
-
function
|
|
644
|
-
return
|
|
794
|
+
function Z() {
|
|
795
|
+
return X.prototype;
|
|
645
796
|
}
|
|
646
|
-
function
|
|
647
|
-
return typeof e == "object" && !!e && e[
|
|
797
|
+
function Ce(e) {
|
|
798
|
+
return typeof e == "object" && !!e && e[J] === !0;
|
|
648
799
|
}
|
|
649
|
-
function
|
|
650
|
-
let n = Object.getOwnPropertyDescriptor(
|
|
651
|
-
Object.defineProperty(
|
|
800
|
+
function we(e, t) {
|
|
801
|
+
let n = Object.getOwnPropertyDescriptor(Z(), e);
|
|
802
|
+
Object.defineProperty(Z(), e, {
|
|
652
803
|
value: t,
|
|
653
804
|
enumerable: !1,
|
|
654
805
|
writable: n?.writable ?? !1,
|
|
@@ -658,31 +809,31 @@ function Z(e, t) {
|
|
|
658
809
|
function Q(e, t) {
|
|
659
810
|
ne(e, "name"), l(t, "implementation");
|
|
660
811
|
}
|
|
661
|
-
function
|
|
662
|
-
if (Q(e, t), e in
|
|
663
|
-
|
|
812
|
+
function Te(e, t) {
|
|
813
|
+
if (Q(e, t), e in Y([])) throw Error(`"${e}" already exists on IIterableLinq: use override() to replace it`);
|
|
814
|
+
we(e, t);
|
|
664
815
|
}
|
|
665
|
-
function
|
|
816
|
+
function Ee(e, t) {
|
|
666
817
|
Q(e, t);
|
|
667
818
|
let n = e;
|
|
668
|
-
if (!(n !== "constructor" && Object.prototype.hasOwnProperty.call(
|
|
669
|
-
|
|
819
|
+
if (!(n !== "constructor" && Object.prototype.hasOwnProperty.call(Z(), n))) throw Error(`"${n}" is not a method of IIterableLinq: use extend() to add it`);
|
|
820
|
+
we(n, t);
|
|
670
821
|
}
|
|
671
822
|
//#endregion
|
|
672
823
|
//#region src/index.ts
|
|
673
|
-
function
|
|
824
|
+
function De() {
|
|
674
825
|
return $(_());
|
|
675
826
|
}
|
|
676
827
|
function $(e) {
|
|
677
|
-
return c(e),
|
|
828
|
+
return c(e), Y(e);
|
|
678
829
|
}
|
|
679
|
-
function
|
|
680
|
-
if (typeof t == "number") return $(
|
|
830
|
+
function Oe(e, t, n) {
|
|
831
|
+
if (typeof t == "number") return $(R(e, t, n));
|
|
681
832
|
if (n !== void 0) throw Error("The \"options\" parameter must be the second argument when \"start\" is omitted");
|
|
682
|
-
return $(
|
|
833
|
+
return $(R(e, t));
|
|
683
834
|
}
|
|
684
|
-
function
|
|
835
|
+
function ke(e, t) {
|
|
685
836
|
return $(B(e, t));
|
|
686
837
|
}
|
|
687
838
|
//#endregion
|
|
688
|
-
export {
|
|
839
|
+
export { Se as Functions, S as Unit, De as empty, Te as extend, $ as from, Oe as fromRange, Ce as isIterableLinq, Ee as override, ke as repeat, C as unit };
|