iterable-linq-utility 0.8.0 → 0.9.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 +35 -12
- package/dist/index.d.cts +92 -0
- package/dist/index.d.ts +92 -0
- package/dist/iterable-linq-utility.js +264 -223
- package/dist/iterable-linq-utility.umd.cjs +1 -1
- package/package.json +2 -1
|
@@ -121,10 +121,10 @@ var p = class {
|
|
|
121
121
|
};
|
|
122
122
|
//#endregion
|
|
123
123
|
//#region src/iterators/unfold.ts
|
|
124
|
-
function
|
|
125
|
-
return new m(() => new
|
|
124
|
+
function re(e, t) {
|
|
125
|
+
return new m(() => new ie(e, t));
|
|
126
126
|
}
|
|
127
|
-
var
|
|
127
|
+
var ie = class extends p {
|
|
128
128
|
state;
|
|
129
129
|
step;
|
|
130
130
|
constructor(e, t) {
|
|
@@ -137,10 +137,10 @@ var re = class extends p {
|
|
|
137
137
|
};
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region src/functions/append.ts
|
|
140
|
-
function
|
|
141
|
-
return l(e, "append"), new m(() => new
|
|
140
|
+
function ae(e, t) {
|
|
141
|
+
return l(e, "append"), new m(() => new oe(e, t));
|
|
142
142
|
}
|
|
143
|
-
var
|
|
143
|
+
var oe = class extends h {
|
|
144
144
|
value;
|
|
145
145
|
sourceDone = !1;
|
|
146
146
|
constructor(e, t) {
|
|
@@ -154,21 +154,21 @@ var ae = class extends h {
|
|
|
154
154
|
};
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region src/functions/at.ts
|
|
157
|
-
function oe(e, t) {
|
|
158
|
-
return l(e, "at"), d(t, "index", "at"), t >= 0 ? se(e, t) : ce(e, -t);
|
|
159
|
-
}
|
|
160
157
|
function se(e, t) {
|
|
158
|
+
return l(e, "at"), d(t, "index", "at"), t >= 0 ? ce(e, t) : le(e, -t);
|
|
159
|
+
}
|
|
160
|
+
function ce(e, t) {
|
|
161
161
|
let n = 0;
|
|
162
162
|
for (let r of e) if (n++ === t) return r;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function le(e, t) {
|
|
165
165
|
let n = [], r = 0, i = !1;
|
|
166
166
|
for (let a of e) n[r] = a, ++r === t && (r = 0, i = !0);
|
|
167
167
|
return i ? n[r] : void 0;
|
|
168
168
|
}
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/functions/average.ts
|
|
171
|
-
function
|
|
171
|
+
function ue(e, t) {
|
|
172
172
|
l(e, "average");
|
|
173
173
|
let n = 0, r = 0;
|
|
174
174
|
if (t === void 0) for (let t of e) n += t, r++;
|
|
@@ -180,7 +180,7 @@ function le(e, t) {
|
|
|
180
180
|
}
|
|
181
181
|
//#endregion
|
|
182
182
|
//#region src/functions/collectToArray.ts
|
|
183
|
-
function
|
|
183
|
+
function g(e) {
|
|
184
184
|
if (l(e, "collectToArray"), Array.isArray(e) || e instanceof Set) return Array.from(e);
|
|
185
185
|
let t = [];
|
|
186
186
|
for (let n of e) t.push(n);
|
|
@@ -188,13 +188,13 @@ function ue(e) {
|
|
|
188
188
|
}
|
|
189
189
|
//#endregion
|
|
190
190
|
//#region src/functions/concat.ts
|
|
191
|
-
function
|
|
191
|
+
function de(e, ...t) {
|
|
192
192
|
l(e, "concat");
|
|
193
193
|
for (let e of t) l(e, "concat");
|
|
194
194
|
let n = [e, ...t];
|
|
195
|
-
return new m(() => new
|
|
195
|
+
return new m(() => new fe(n));
|
|
196
196
|
}
|
|
197
|
-
var
|
|
197
|
+
var fe = class extends p {
|
|
198
198
|
sources;
|
|
199
199
|
position = 0;
|
|
200
200
|
current;
|
|
@@ -214,7 +214,7 @@ var de = class extends p {
|
|
|
214
214
|
};
|
|
215
215
|
//#endregion
|
|
216
216
|
//#region src/functions/count.ts
|
|
217
|
-
function
|
|
217
|
+
function _(e, t) {
|
|
218
218
|
l(e, "count");
|
|
219
219
|
let n = 0;
|
|
220
220
|
if (t === void 0) {
|
|
@@ -228,10 +228,10 @@ function v(e, t) {
|
|
|
228
228
|
}
|
|
229
229
|
//#endregion
|
|
230
230
|
//#region src/functions/distinct.ts
|
|
231
|
-
function
|
|
232
|
-
return l(e, "distinct"), t !== void 0 && u(t, "keySelector", "distinct"), new m(() => new
|
|
231
|
+
function v(e, t) {
|
|
232
|
+
return l(e, "distinct"), t !== void 0 && u(t, "keySelector", "distinct"), new m(() => new pe(e, t));
|
|
233
233
|
}
|
|
234
|
-
var
|
|
234
|
+
var pe = class extends h {
|
|
235
235
|
keySelector;
|
|
236
236
|
seen = /* @__PURE__ */ new Set();
|
|
237
237
|
constructor(e, t) {
|
|
@@ -252,12 +252,12 @@ var fe = class extends h {
|
|
|
252
252
|
};
|
|
253
253
|
//#endregion
|
|
254
254
|
//#region src/functions/empty.ts
|
|
255
|
-
function
|
|
256
|
-
return
|
|
255
|
+
function y() {
|
|
256
|
+
return re(void 0, () => void 0);
|
|
257
257
|
}
|
|
258
258
|
//#endregion
|
|
259
259
|
//#region src/functions/every.ts
|
|
260
|
-
function
|
|
260
|
+
function b(e, t) {
|
|
261
261
|
l(e, "every"), u(t, "predicate", "every");
|
|
262
262
|
let n = 0;
|
|
263
263
|
for (let r of e) if (!t(r, n++)) return !1;
|
|
@@ -265,10 +265,10 @@ function x(e, t) {
|
|
|
265
265
|
}
|
|
266
266
|
//#endregion
|
|
267
267
|
//#region src/functions/filter.ts
|
|
268
|
-
function
|
|
269
|
-
return l(e, "filter"), u(t, "predicate", "filter"), new m(() => new
|
|
268
|
+
function x(e, t) {
|
|
269
|
+
return l(e, "filter"), u(t, "predicate", "filter"), new m(() => new me(e, t));
|
|
270
270
|
}
|
|
271
|
-
var
|
|
271
|
+
var me = class extends h {
|
|
272
272
|
predicate;
|
|
273
273
|
constructor(e, t) {
|
|
274
274
|
super(e), this.predicate = t;
|
|
@@ -288,14 +288,14 @@ var pe = class extends h {
|
|
|
288
288
|
};
|
|
289
289
|
//#endregion
|
|
290
290
|
//#region src/functions/find.ts
|
|
291
|
-
function
|
|
291
|
+
function S(e, t) {
|
|
292
292
|
l(e, "find"), u(t, "predicate", "find");
|
|
293
293
|
let n = 0;
|
|
294
294
|
for (let r of e) if (t(r, n++)) return r;
|
|
295
295
|
}
|
|
296
296
|
//#endregion
|
|
297
297
|
//#region src/functions/findIndex.ts
|
|
298
|
-
function
|
|
298
|
+
function C(e, t) {
|
|
299
299
|
l(e, "findIndex"), u(t, "predicate", "findIndex");
|
|
300
300
|
let n = 0;
|
|
301
301
|
for (let r of e) {
|
|
@@ -306,7 +306,7 @@ function w(e, t) {
|
|
|
306
306
|
}
|
|
307
307
|
//#endregion
|
|
308
308
|
//#region src/functions/findLast.ts
|
|
309
|
-
function
|
|
309
|
+
function w(e, t) {
|
|
310
310
|
l(e, "findLast"), u(t, "predicate", "findLast");
|
|
311
311
|
let n, r = 0;
|
|
312
312
|
for (let i of e) t(i, r++) && (n = i);
|
|
@@ -314,7 +314,7 @@ function T(e, t) {
|
|
|
314
314
|
}
|
|
315
315
|
//#endregion
|
|
316
316
|
//#region src/functions/findLastIndex.ts
|
|
317
|
-
function
|
|
317
|
+
function T(e, t) {
|
|
318
318
|
l(e, "findLastIndex"), u(t, "predicate", "findLastIndex");
|
|
319
319
|
let n = -1, r = 0;
|
|
320
320
|
for (let i of e) t(i, r) && (n = r), r++;
|
|
@@ -322,10 +322,10 @@ function E(e, t) {
|
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/functions/flatMap.ts
|
|
325
|
-
function
|
|
326
|
-
return l(e, "flatMap"), u(t, "mapper", "flatMap"), new m(() => new
|
|
325
|
+
function E(e, t) {
|
|
326
|
+
return l(e, "flatMap"), u(t, "mapper", "flatMap"), new m(() => new he(e, t));
|
|
327
327
|
}
|
|
328
|
-
var
|
|
328
|
+
var he = class e extends h {
|
|
329
329
|
mapper;
|
|
330
330
|
static steps = {
|
|
331
331
|
outer: (t) => {
|
|
@@ -386,7 +386,7 @@ var me = class e extends h {
|
|
|
386
386
|
throw e.inner = void 0, e.closeAfterCallbackError(), t;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
},
|
|
389
|
+
}, D = class e {
|
|
390
390
|
static instance = e.createFrozen();
|
|
391
391
|
constructor() {}
|
|
392
392
|
static createFrozen() {
|
|
@@ -394,26 +394,26 @@ var me = class e extends h {
|
|
|
394
394
|
return Object.freeze(t), t;
|
|
395
395
|
}
|
|
396
396
|
};
|
|
397
|
-
function
|
|
398
|
-
return
|
|
397
|
+
function O() {
|
|
398
|
+
return D.instance;
|
|
399
399
|
}
|
|
400
400
|
//#endregion
|
|
401
401
|
//#region src/functions/forEach.ts
|
|
402
|
-
function
|
|
402
|
+
function k(e, t) {
|
|
403
403
|
l(e, "forEach"), u(t, "action", "forEach");
|
|
404
404
|
let n = 0;
|
|
405
405
|
for (let r of e) t(r, n++);
|
|
406
|
-
return
|
|
406
|
+
return O();
|
|
407
407
|
}
|
|
408
|
-
async function
|
|
408
|
+
async function A(e, t) {
|
|
409
409
|
l(e, "forEachAsync"), u(t, "action", "forEachAsync");
|
|
410
410
|
let n = 0;
|
|
411
411
|
for (let r of e) await t(r, n++);
|
|
412
|
-
return
|
|
412
|
+
return O();
|
|
413
413
|
}
|
|
414
414
|
//#endregion
|
|
415
415
|
//#region src/functions/includes.ts
|
|
416
|
-
function
|
|
416
|
+
function j(e, t) {
|
|
417
417
|
l(e, "includes");
|
|
418
418
|
let n = t !== t;
|
|
419
419
|
for (let r of e) if (r === t || n && r !== r) return !0;
|
|
@@ -421,7 +421,7 @@ function M(e, t) {
|
|
|
421
421
|
}
|
|
422
422
|
//#endregion
|
|
423
423
|
//#region src/functions/indexOf.ts
|
|
424
|
-
function
|
|
424
|
+
function M(e, t) {
|
|
425
425
|
l(e, "indexOf");
|
|
426
426
|
let n = 0;
|
|
427
427
|
for (let r of e) {
|
|
@@ -432,12 +432,12 @@ function N(e, t) {
|
|
|
432
432
|
}
|
|
433
433
|
//#endregion
|
|
434
434
|
//#region src/functions/join.ts
|
|
435
|
-
function
|
|
435
|
+
function N(e, t) {
|
|
436
436
|
return l(e, "join"), Array.from(e).join(t);
|
|
437
437
|
}
|
|
438
438
|
//#endregion
|
|
439
439
|
//#region src/functions/lastIndexOf.ts
|
|
440
|
-
function
|
|
440
|
+
function P(e, t) {
|
|
441
441
|
l(e, "lastIndexOf");
|
|
442
442
|
let n = -1, r = 0;
|
|
443
443
|
for (let i of e) i === t && (n = r), r++;
|
|
@@ -445,10 +445,10 @@ function F(e, t) {
|
|
|
445
445
|
}
|
|
446
446
|
//#endregion
|
|
447
447
|
//#region src/functions/map.ts
|
|
448
|
-
function
|
|
449
|
-
return l(e, "map"), u(t, "mapper", "map"), new m(() => new
|
|
448
|
+
function F(e, t) {
|
|
449
|
+
return l(e, "map"), u(t, "mapper", "map"), new m(() => new ge(e, t));
|
|
450
450
|
}
|
|
451
|
-
var
|
|
451
|
+
var ge = class extends h {
|
|
452
452
|
mapper;
|
|
453
453
|
constructor(e, t) {
|
|
454
454
|
super(e), this.mapper = t;
|
|
@@ -467,13 +467,13 @@ var he = class extends h {
|
|
|
467
467
|
};
|
|
468
468
|
//#endregion
|
|
469
469
|
//#region src/collections/linkedList.ts
|
|
470
|
-
function
|
|
470
|
+
function _e(e) {
|
|
471
471
|
l(e, "LinkedList.from");
|
|
472
|
-
let t = new
|
|
472
|
+
let t = new I();
|
|
473
473
|
for (let n of e) t.addLast(n);
|
|
474
474
|
return t;
|
|
475
475
|
}
|
|
476
|
-
var
|
|
476
|
+
var I = class {
|
|
477
477
|
internalSize = 0;
|
|
478
478
|
head = null;
|
|
479
479
|
tail = null;
|
|
@@ -515,7 +515,7 @@ function L(e) {
|
|
|
515
515
|
var R = class {
|
|
516
516
|
source;
|
|
517
517
|
constructor(e) {
|
|
518
|
-
this.source =
|
|
518
|
+
this.source = _e(e);
|
|
519
519
|
}
|
|
520
520
|
[Symbol.iterator]() {
|
|
521
521
|
return this.source[Symbol.iterator]();
|
|
@@ -564,7 +564,7 @@ var W = class {
|
|
|
564
564
|
this.source = e;
|
|
565
565
|
}
|
|
566
566
|
[Symbol.iterator]() {
|
|
567
|
-
return new
|
|
567
|
+
return new ye(this.source, this.cache, !0);
|
|
568
568
|
}
|
|
569
569
|
changePartialMemoizationBehaviour() {
|
|
570
570
|
return new G(this.source);
|
|
@@ -576,12 +576,12 @@ var W = class {
|
|
|
576
576
|
this.source = e;
|
|
577
577
|
}
|
|
578
578
|
[Symbol.iterator]() {
|
|
579
|
-
return new
|
|
579
|
+
return new ye(this.source, this.cache, !1);
|
|
580
580
|
}
|
|
581
581
|
changePartialMemoizationBehaviour() {
|
|
582
582
|
return new W(this.source);
|
|
583
583
|
}
|
|
584
|
-
},
|
|
584
|
+
}, ye = class extends p {
|
|
585
585
|
source;
|
|
586
586
|
cache;
|
|
587
587
|
drainFirst;
|
|
@@ -596,15 +596,15 @@ var W = class {
|
|
|
596
596
|
};
|
|
597
597
|
//#endregion
|
|
598
598
|
//#region src/functions/min.ts
|
|
599
|
-
function
|
|
599
|
+
function be(e, t) {
|
|
600
600
|
return l(e, "min"), a(e, i(t), -1);
|
|
601
601
|
}
|
|
602
602
|
//#endregion
|
|
603
603
|
//#region src/functions/prepend.ts
|
|
604
|
-
function
|
|
605
|
-
return l(e, "prepend"), new m(() => new
|
|
604
|
+
function xe(e, t) {
|
|
605
|
+
return l(e, "prepend"), new m(() => new Se(e, t));
|
|
606
606
|
}
|
|
607
|
-
var
|
|
607
|
+
var Se = class extends h {
|
|
608
608
|
value;
|
|
609
609
|
valueYielded = !1;
|
|
610
610
|
constructor(e, t) {
|
|
@@ -616,17 +616,17 @@ var be = class extends h {
|
|
|
616
616
|
};
|
|
617
617
|
//#endregion
|
|
618
618
|
//#region src/functions/range.ts
|
|
619
|
-
function
|
|
619
|
+
function K(e, t, n) {
|
|
620
620
|
let r = typeof t == "number", i = r ? e : 0, a = r ? t : e;
|
|
621
621
|
if (!r && n !== void 0) throw c("range", "The \"options\" parameter must be the second argument when \"start\" is omitted");
|
|
622
622
|
let o = r ? n : t;
|
|
623
623
|
o !== void 0 && te(o, "options", "range");
|
|
624
624
|
let { step: s = 1, reverse: l = !1 } = o ?? {};
|
|
625
625
|
ee(s, "step", "range");
|
|
626
|
-
let u =
|
|
627
|
-
return u.length > 0 ? new m(() => new
|
|
626
|
+
let u = Ce(i, a, Math.abs(s), l);
|
|
627
|
+
return u.length > 0 ? new m(() => new we(u.first, u.step, u.length)) : y();
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Ce(e, t, n, r) {
|
|
630
630
|
let i = t < e ? -n : n, a = Math.ceil(Math.abs(t - e) / n);
|
|
631
631
|
return r ? {
|
|
632
632
|
first: e + (a - 1) * i,
|
|
@@ -638,7 +638,7 @@ function xe(e, t, n, r) {
|
|
|
638
638
|
length: a
|
|
639
639
|
};
|
|
640
640
|
}
|
|
641
|
-
var
|
|
641
|
+
var we = class extends p {
|
|
642
642
|
first;
|
|
643
643
|
step;
|
|
644
644
|
length;
|
|
@@ -652,15 +652,15 @@ var Se = class extends p {
|
|
|
652
652
|
};
|
|
653
653
|
//#endregion
|
|
654
654
|
//#region src/functions/reduce.ts
|
|
655
|
-
function
|
|
656
|
-
if (l(e, "reduce"), t.length === 1) return
|
|
655
|
+
function q(e, ...t) {
|
|
656
|
+
if (l(e, "reduce"), t.length === 1) return Te(e, t[0]);
|
|
657
657
|
let [n, r] = t;
|
|
658
658
|
u(r, "reducer", "reduce");
|
|
659
659
|
let i = n, a = 0;
|
|
660
660
|
for (let t of e) i = r(i, t, a++);
|
|
661
661
|
return i;
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function Te(e, t) {
|
|
664
664
|
u(t, "reducer", "reduce");
|
|
665
665
|
let n, r = 0;
|
|
666
666
|
for (let i of e) n = r === 0 ? i : t(n, i, r), r++;
|
|
@@ -669,17 +669,36 @@ function Ce(e, t) {
|
|
|
669
669
|
}
|
|
670
670
|
//#endregion
|
|
671
671
|
//#region src/functions/repeat.ts
|
|
672
|
-
function
|
|
673
|
-
return f(t, "count", "repeat"),
|
|
672
|
+
function Ee(e, t) {
|
|
673
|
+
return f(t, "count", "repeat"), re(t, (t) => t > 0 ? [e, t - 1] : void 0);
|
|
674
|
+
}
|
|
675
|
+
//#endregion
|
|
676
|
+
//#region src/functions/reverse.ts
|
|
677
|
+
function De(e) {
|
|
678
|
+
return l(e, "reverse"), new m(() => new Oe(e));
|
|
674
679
|
}
|
|
680
|
+
var Oe = class extends h {
|
|
681
|
+
reversed;
|
|
682
|
+
advance() {
|
|
683
|
+
return this.reversed ??= this.fill(), this.reversed.next();
|
|
684
|
+
}
|
|
685
|
+
onReturn(e) {
|
|
686
|
+
this.reversed = void 0, super.onReturn(e);
|
|
687
|
+
}
|
|
688
|
+
fill() {
|
|
689
|
+
let e = new I();
|
|
690
|
+
for (let t = this.source.next(); t.done !== !0; t = this.source.next()) e.addFirst(t.value);
|
|
691
|
+
return e[Symbol.iterator]();
|
|
692
|
+
}
|
|
693
|
+
};
|
|
675
694
|
//#endregion
|
|
676
695
|
//#region src/functions/sequenceEqual.ts
|
|
677
|
-
function
|
|
696
|
+
function ke(e, t) {
|
|
678
697
|
return e === t;
|
|
679
698
|
}
|
|
680
|
-
function
|
|
699
|
+
function Ae(e, t, n) {
|
|
681
700
|
l(e, "sequenceEqual"), l(t, "sequenceEqual"), n !== void 0 && u(n, "equals", "sequenceEqual");
|
|
682
|
-
let r = n ??
|
|
701
|
+
let r = n ?? ke, i = t[Symbol.iterator](), a = !0;
|
|
683
702
|
try {
|
|
684
703
|
for (let t of e) {
|
|
685
704
|
a = !1;
|
|
@@ -693,7 +712,7 @@ function Ee(e, t, n) {
|
|
|
693
712
|
}
|
|
694
713
|
//#endregion
|
|
695
714
|
//#region src/functions/single.ts
|
|
696
|
-
function
|
|
715
|
+
function je(e, t) {
|
|
697
716
|
l(e, "single");
|
|
698
717
|
let n = !1, r;
|
|
699
718
|
if (t === void 0) {
|
|
@@ -713,10 +732,10 @@ function De(e, t) {
|
|
|
713
732
|
}
|
|
714
733
|
//#endregion
|
|
715
734
|
//#region src/functions/skip.ts
|
|
716
|
-
function
|
|
717
|
-
return l(e, "skip"), f(t, "count", "skip"), new m(() => new
|
|
735
|
+
function Me(e, t) {
|
|
736
|
+
return l(e, "skip"), f(t, "count", "skip"), new m(() => new Ne(e, t));
|
|
718
737
|
}
|
|
719
|
-
var
|
|
738
|
+
var Ne = class extends h {
|
|
720
739
|
count;
|
|
721
740
|
constructor(e, t) {
|
|
722
741
|
super(e), this.count = t;
|
|
@@ -731,41 +750,16 @@ var ke = class extends h {
|
|
|
731
750
|
}
|
|
732
751
|
};
|
|
733
752
|
//#endregion
|
|
734
|
-
//#region src/functions/skipWhile.ts
|
|
735
|
-
function Ae(e, t) {
|
|
736
|
-
return l(e, "skipWhile"), u(t, "predicate", "skipWhile"), new m(() => new je(e, t));
|
|
737
|
-
}
|
|
738
|
-
var je = class extends h {
|
|
739
|
-
predicate;
|
|
740
|
-
skipping = !0;
|
|
741
|
-
constructor(e, t) {
|
|
742
|
-
super(e), this.predicate = t;
|
|
743
|
-
}
|
|
744
|
-
advance() {
|
|
745
|
-
if (!this.skipping) return this.source.next();
|
|
746
|
-
for (let e = this.source.next();; e = this.source.next()) {
|
|
747
|
-
if (e.done === !0) return e;
|
|
748
|
-
let t;
|
|
749
|
-
try {
|
|
750
|
-
t = this.predicate(e.value, this.index++);
|
|
751
|
-
} catch (e) {
|
|
752
|
-
throw this.closeAfterCallbackError(), e;
|
|
753
|
-
}
|
|
754
|
-
if (!t) return this.skipping = !1, e;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
};
|
|
758
|
-
//#endregion
|
|
759
753
|
//#region src/functions/slice.ts
|
|
760
|
-
function
|
|
754
|
+
function J(e, t, n) {
|
|
761
755
|
l(e, "slice"), t !== void 0 && d(t, "start", "slice"), n !== void 0 && d(n, "end", "slice");
|
|
762
756
|
let r = t ?? 0;
|
|
763
|
-
if (r < 0) return new m(() => new
|
|
764
|
-
if (n !== void 0 && n < 0) return new m(() => new
|
|
757
|
+
if (r < 0) return new m(() => new Ie(e, -r, n));
|
|
758
|
+
if (n !== void 0 && n < 0) return new m(() => new Fe(e, r, -n));
|
|
765
759
|
let i = n === void 0 ? Infinity : n > r ? n : 0;
|
|
766
|
-
return new m(() => new
|
|
760
|
+
return new m(() => new Pe(e, r, i));
|
|
767
761
|
}
|
|
768
|
-
var
|
|
762
|
+
var Pe = class extends h {
|
|
769
763
|
start;
|
|
770
764
|
end;
|
|
771
765
|
constructor(e, t, n) {
|
|
@@ -781,7 +775,7 @@ var Ne = class extends h {
|
|
|
781
775
|
let e = this.source.next();
|
|
782
776
|
return e.done !== !0 && this.index++, e;
|
|
783
777
|
}
|
|
784
|
-
},
|
|
778
|
+
}, Fe = class extends h {
|
|
785
779
|
start;
|
|
786
780
|
size;
|
|
787
781
|
buffer = [];
|
|
@@ -808,7 +802,7 @@ var Ne = class extends h {
|
|
|
808
802
|
store(e) {
|
|
809
803
|
this.buffer[this.position] = e, ++this.position === this.size && (this.position = 0, this.full = !0);
|
|
810
804
|
}
|
|
811
|
-
},
|
|
805
|
+
}, Ie = class extends h {
|
|
812
806
|
size;
|
|
813
807
|
end;
|
|
814
808
|
buffer;
|
|
@@ -831,8 +825,38 @@ var Ne = class extends h {
|
|
|
831
825
|
}
|
|
832
826
|
};
|
|
833
827
|
//#endregion
|
|
828
|
+
//#region src/functions/skipLast.ts
|
|
829
|
+
function Le(e, t) {
|
|
830
|
+
return l(e, "skipLast"), f(t, "count", "skipLast"), t === 0 ? J(e) : J(e, 0, -t);
|
|
831
|
+
}
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region src/functions/skipWhile.ts
|
|
834
|
+
function Re(e, t) {
|
|
835
|
+
return l(e, "skipWhile"), u(t, "predicate", "skipWhile"), new m(() => new ze(e, t));
|
|
836
|
+
}
|
|
837
|
+
var ze = class extends h {
|
|
838
|
+
predicate;
|
|
839
|
+
skipping = !0;
|
|
840
|
+
constructor(e, t) {
|
|
841
|
+
super(e), this.predicate = t;
|
|
842
|
+
}
|
|
843
|
+
advance() {
|
|
844
|
+
if (!this.skipping) return this.source.next();
|
|
845
|
+
for (let e = this.source.next();; e = this.source.next()) {
|
|
846
|
+
if (e.done === !0) return e;
|
|
847
|
+
let t;
|
|
848
|
+
try {
|
|
849
|
+
t = this.predicate(e.value, this.index++);
|
|
850
|
+
} catch (e) {
|
|
851
|
+
throw this.closeAfterCallbackError(), e;
|
|
852
|
+
}
|
|
853
|
+
if (!t) return this.skipping = !1, e;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
//#endregion
|
|
834
858
|
//#region src/functions/some.ts
|
|
835
|
-
function
|
|
859
|
+
function Be(e, t) {
|
|
836
860
|
if (l(e, "some"), t === void 0) {
|
|
837
861
|
for (let t of e) return !0;
|
|
838
862
|
return !1;
|
|
@@ -844,7 +868,7 @@ function Ie(e, t) {
|
|
|
844
868
|
}
|
|
845
869
|
//#endregion
|
|
846
870
|
//#region src/functions/sum.ts
|
|
847
|
-
function
|
|
871
|
+
function Ve(e, t) {
|
|
848
872
|
l(e, "sum");
|
|
849
873
|
let n = 0;
|
|
850
874
|
if (t === void 0) {
|
|
@@ -858,10 +882,10 @@ function Le(e, t) {
|
|
|
858
882
|
}
|
|
859
883
|
//#endregion
|
|
860
884
|
//#region src/functions/take.ts
|
|
861
|
-
function
|
|
862
|
-
return l(e, "take"), f(t, "count", "take"), new m(() => new
|
|
885
|
+
function He(e, t) {
|
|
886
|
+
return l(e, "take"), f(t, "count", "take"), new m(() => new Ue(e, t));
|
|
863
887
|
}
|
|
864
|
-
var
|
|
888
|
+
var Ue = class extends h {
|
|
865
889
|
count;
|
|
866
890
|
constructor(e, t) {
|
|
867
891
|
super(e), this.count = t;
|
|
@@ -873,11 +897,16 @@ var ze = class extends h {
|
|
|
873
897
|
}
|
|
874
898
|
};
|
|
875
899
|
//#endregion
|
|
900
|
+
//#region src/functions/takeLast.ts
|
|
901
|
+
function We(e, t) {
|
|
902
|
+
return l(e, "takeLast"), f(t, "count", "takeLast"), t === 0 ? J(e, 0, 0) : J(e, -t);
|
|
903
|
+
}
|
|
904
|
+
//#endregion
|
|
876
905
|
//#region src/functions/takeWhile.ts
|
|
877
|
-
function
|
|
878
|
-
return l(e, "takeWhile"), u(t, "predicate", "takeWhile"), new m(() => new
|
|
906
|
+
function Ge(e, t) {
|
|
907
|
+
return l(e, "takeWhile"), u(t, "predicate", "takeWhile"), new m(() => new Ke(e, t));
|
|
879
908
|
}
|
|
880
|
-
var
|
|
909
|
+
var Ke = class extends h {
|
|
881
910
|
predicate;
|
|
882
911
|
constructor(e, t) {
|
|
883
912
|
super(e), this.predicate = t;
|
|
@@ -896,10 +925,10 @@ var Ve = class extends h {
|
|
|
896
925
|
};
|
|
897
926
|
//#endregion
|
|
898
927
|
//#region src/functions/tap.ts
|
|
899
|
-
function
|
|
900
|
-
return l(e, "tap"), u(t, "tapper", "tap"), new m(() => new
|
|
928
|
+
function qe(e, t) {
|
|
929
|
+
return l(e, "tap"), u(t, "tapper", "tap"), new m(() => new Je(e, t));
|
|
901
930
|
}
|
|
902
|
-
var
|
|
931
|
+
var Je = class extends h {
|
|
903
932
|
tapper;
|
|
904
933
|
constructor(e, t) {
|
|
905
934
|
super(e), this.tapper = t;
|
|
@@ -917,61 +946,64 @@ var Ue = class extends h {
|
|
|
917
946
|
};
|
|
918
947
|
//#endregion
|
|
919
948
|
//#region src/functions/tapChain.ts
|
|
920
|
-
function
|
|
949
|
+
function Ye(e, t) {
|
|
921
950
|
return l(e, "tapChain"), u(t, "tapper", "tapChain"), new m(() => (t(e, 0), e[Symbol.iterator]()));
|
|
922
951
|
}
|
|
923
952
|
//#endregion
|
|
924
953
|
//#region src/functions/index.ts
|
|
925
|
-
var
|
|
926
|
-
append: () =>
|
|
927
|
-
at: () =>
|
|
928
|
-
average: () =>
|
|
929
|
-
collectToArray: () =>
|
|
930
|
-
concat: () =>
|
|
931
|
-
count: () =>
|
|
932
|
-
distinct: () =>
|
|
933
|
-
empty: () =>
|
|
934
|
-
every: () =>
|
|
935
|
-
filter: () =>
|
|
936
|
-
find: () =>
|
|
937
|
-
findIndex: () =>
|
|
938
|
-
findLast: () =>
|
|
939
|
-
findLastIndex: () =>
|
|
940
|
-
flatMap: () =>
|
|
941
|
-
forEach: () =>
|
|
942
|
-
forEachAsync: () =>
|
|
954
|
+
var Xe = /* @__PURE__ */ t({
|
|
955
|
+
append: () => ae,
|
|
956
|
+
at: () => se,
|
|
957
|
+
average: () => ue,
|
|
958
|
+
collectToArray: () => g,
|
|
959
|
+
concat: () => de,
|
|
960
|
+
count: () => _,
|
|
961
|
+
distinct: () => v,
|
|
962
|
+
empty: () => y,
|
|
963
|
+
every: () => b,
|
|
964
|
+
filter: () => x,
|
|
965
|
+
find: () => S,
|
|
966
|
+
findIndex: () => C,
|
|
967
|
+
findLast: () => w,
|
|
968
|
+
findLastIndex: () => T,
|
|
969
|
+
flatMap: () => E,
|
|
970
|
+
forEach: () => k,
|
|
971
|
+
forEachAsync: () => A,
|
|
943
972
|
getMemoizeDefaultOptions: () => B,
|
|
944
|
-
includes: () =>
|
|
945
|
-
indexOf: () =>
|
|
946
|
-
join: () =>
|
|
947
|
-
lastIndexOf: () =>
|
|
948
|
-
map: () =>
|
|
973
|
+
includes: () => j,
|
|
974
|
+
indexOf: () => M,
|
|
975
|
+
join: () => N,
|
|
976
|
+
lastIndexOf: () => P,
|
|
977
|
+
map: () => F,
|
|
949
978
|
materialize: () => L,
|
|
950
979
|
max: () => z,
|
|
951
980
|
memoize: () => V,
|
|
952
|
-
min: () =>
|
|
953
|
-
prepend: () =>
|
|
954
|
-
range: () =>
|
|
955
|
-
reduce: () =>
|
|
956
|
-
repeat: () =>
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
981
|
+
min: () => be,
|
|
982
|
+
prepend: () => xe,
|
|
983
|
+
range: () => K,
|
|
984
|
+
reduce: () => q,
|
|
985
|
+
repeat: () => Ee,
|
|
986
|
+
reverse: () => De,
|
|
987
|
+
sequenceEqual: () => Ae,
|
|
988
|
+
single: () => je,
|
|
989
|
+
skip: () => Me,
|
|
990
|
+
skipLast: () => Le,
|
|
991
|
+
skipWhile: () => Re,
|
|
992
|
+
slice: () => J,
|
|
993
|
+
some: () => Be,
|
|
994
|
+
sum: () => Ve,
|
|
995
|
+
take: () => He,
|
|
996
|
+
takeLast: () => We,
|
|
997
|
+
takeWhile: () => Ge,
|
|
998
|
+
tap: () => qe,
|
|
999
|
+
tapChain: () => Ye
|
|
1000
|
+
}), Ze = Symbol.for("iterable-linq-utility.IIterableLinq");
|
|
969
1001
|
//#endregion
|
|
970
1002
|
//#region src/linqIterable.ts
|
|
971
|
-
function
|
|
972
|
-
return new
|
|
1003
|
+
function Y(e) {
|
|
1004
|
+
return new X(e);
|
|
973
1005
|
}
|
|
974
|
-
var
|
|
1006
|
+
var X = class {
|
|
975
1007
|
iterable;
|
|
976
1008
|
constructor(e) {
|
|
977
1009
|
this.iterable = e;
|
|
@@ -980,118 +1012,127 @@ var Z = class {
|
|
|
980
1012
|
return this.iterable[Symbol.iterator]();
|
|
981
1013
|
}
|
|
982
1014
|
append(e) {
|
|
983
|
-
return
|
|
1015
|
+
return Y(ae(this.iterable, e));
|
|
984
1016
|
}
|
|
985
1017
|
at(e) {
|
|
986
|
-
return
|
|
1018
|
+
return se(this.iterable, e);
|
|
987
1019
|
}
|
|
988
1020
|
average(e) {
|
|
989
|
-
return
|
|
1021
|
+
return ue(this.iterable, e);
|
|
990
1022
|
}
|
|
991
1023
|
collectToArray() {
|
|
992
|
-
return
|
|
1024
|
+
return g(this.iterable);
|
|
993
1025
|
}
|
|
994
1026
|
concat(...e) {
|
|
995
|
-
return
|
|
1027
|
+
return Y(de(this.iterable, ...e));
|
|
996
1028
|
}
|
|
997
1029
|
count(e) {
|
|
998
|
-
return
|
|
1030
|
+
return _(this.iterable, e);
|
|
999
1031
|
}
|
|
1000
1032
|
distinct(e) {
|
|
1001
|
-
return
|
|
1033
|
+
return Y(v(this.iterable, e));
|
|
1002
1034
|
}
|
|
1003
1035
|
every(e) {
|
|
1004
|
-
return
|
|
1036
|
+
return b(this.iterable, e);
|
|
1005
1037
|
}
|
|
1006
1038
|
filter(e) {
|
|
1007
|
-
return
|
|
1039
|
+
return Y(x(this.iterable, e));
|
|
1008
1040
|
}
|
|
1009
1041
|
find(e) {
|
|
1010
|
-
return
|
|
1042
|
+
return S(this.iterable, e);
|
|
1011
1043
|
}
|
|
1012
1044
|
findIndex(e) {
|
|
1013
|
-
return
|
|
1045
|
+
return C(this.iterable, e);
|
|
1014
1046
|
}
|
|
1015
1047
|
findLast(e) {
|
|
1016
|
-
return
|
|
1048
|
+
return w(this.iterable, e);
|
|
1017
1049
|
}
|
|
1018
1050
|
findLastIndex(e) {
|
|
1019
|
-
return
|
|
1051
|
+
return T(this.iterable, e);
|
|
1020
1052
|
}
|
|
1021
1053
|
flatMap(e) {
|
|
1022
|
-
return
|
|
1054
|
+
return Y(E(this.iterable, e));
|
|
1023
1055
|
}
|
|
1024
1056
|
forEach(e) {
|
|
1025
|
-
return
|
|
1057
|
+
return k(this.iterable, e);
|
|
1026
1058
|
}
|
|
1027
1059
|
forEachAsync(e) {
|
|
1028
|
-
return
|
|
1060
|
+
return A(this.iterable, e);
|
|
1029
1061
|
}
|
|
1030
1062
|
includes(e) {
|
|
1031
|
-
return
|
|
1063
|
+
return j(this.iterable, e);
|
|
1032
1064
|
}
|
|
1033
1065
|
indexOf(e) {
|
|
1034
|
-
return
|
|
1066
|
+
return M(this.iterable, e);
|
|
1035
1067
|
}
|
|
1036
1068
|
join(e) {
|
|
1037
|
-
return
|
|
1069
|
+
return N(this.iterable, e);
|
|
1038
1070
|
}
|
|
1039
1071
|
lastIndexOf(e) {
|
|
1040
|
-
return
|
|
1072
|
+
return P(this.iterable, e);
|
|
1041
1073
|
}
|
|
1042
1074
|
map(e) {
|
|
1043
|
-
return
|
|
1075
|
+
return Y(F(this.iterable, e));
|
|
1044
1076
|
}
|
|
1045
1077
|
materialize() {
|
|
1046
|
-
return
|
|
1078
|
+
return Y(L(this.iterable));
|
|
1047
1079
|
}
|
|
1048
1080
|
max(e) {
|
|
1049
1081
|
return z(this.iterable, e);
|
|
1050
1082
|
}
|
|
1051
1083
|
memoize(e) {
|
|
1052
|
-
return
|
|
1084
|
+
return Y(V(this.iterable, e));
|
|
1053
1085
|
}
|
|
1054
1086
|
min(e) {
|
|
1055
|
-
return
|
|
1087
|
+
return be(this.iterable, e);
|
|
1056
1088
|
}
|
|
1057
1089
|
prepend(e) {
|
|
1058
|
-
return
|
|
1090
|
+
return Y(xe(this.iterable, e));
|
|
1059
1091
|
}
|
|
1060
1092
|
reduce(...e) {
|
|
1061
|
-
return e.length === 1 ?
|
|
1093
|
+
return e.length === 1 ? q(this.iterable, e[0]) : q(this.iterable, e[0], e[1]);
|
|
1094
|
+
}
|
|
1095
|
+
reverse() {
|
|
1096
|
+
return Y(De(this.iterable));
|
|
1062
1097
|
}
|
|
1063
1098
|
sequenceEqual(e, t) {
|
|
1064
|
-
return
|
|
1099
|
+
return Ae(this.iterable, e, t);
|
|
1065
1100
|
}
|
|
1066
1101
|
single(e) {
|
|
1067
|
-
return
|
|
1102
|
+
return je(this.iterable, e);
|
|
1068
1103
|
}
|
|
1069
1104
|
skip(e) {
|
|
1070
|
-
return
|
|
1105
|
+
return Y(Me(this.iterable, e));
|
|
1106
|
+
}
|
|
1107
|
+
skipLast(e) {
|
|
1108
|
+
return Y(Le(this.iterable, e));
|
|
1071
1109
|
}
|
|
1072
1110
|
skipWhile(e) {
|
|
1073
|
-
return
|
|
1111
|
+
return Y(Re(this.iterable, e));
|
|
1074
1112
|
}
|
|
1075
1113
|
slice(e, t) {
|
|
1076
|
-
return
|
|
1114
|
+
return Y(J(this.iterable, e, t));
|
|
1077
1115
|
}
|
|
1078
1116
|
some(e) {
|
|
1079
|
-
return
|
|
1117
|
+
return Be(this.iterable, e);
|
|
1080
1118
|
}
|
|
1081
1119
|
sum(e) {
|
|
1082
|
-
return
|
|
1120
|
+
return Ve(this.iterable, e);
|
|
1083
1121
|
}
|
|
1084
1122
|
take(e) {
|
|
1085
|
-
return
|
|
1123
|
+
return Y(He(this.iterable, e));
|
|
1124
|
+
}
|
|
1125
|
+
takeLast(e) {
|
|
1126
|
+
return Y(We(this.iterable, e));
|
|
1086
1127
|
}
|
|
1087
1128
|
takeWhile(e) {
|
|
1088
|
-
return
|
|
1129
|
+
return Y(Ge(this.iterable, e));
|
|
1089
1130
|
}
|
|
1090
1131
|
tap(e) {
|
|
1091
|
-
return
|
|
1132
|
+
return Y(qe(this.iterable, e));
|
|
1092
1133
|
}
|
|
1093
1134
|
tapChain(e) {
|
|
1094
|
-
return
|
|
1135
|
+
return Y(Ye(this.iterable, e));
|
|
1095
1136
|
}
|
|
1096
1137
|
tapChainCreation(e) {
|
|
1097
1138
|
u(e, "chainCreationTapper", "tapChainCreation");
|
|
@@ -1099,7 +1140,7 @@ var Z = class {
|
|
|
1099
1140
|
return e(t), t;
|
|
1100
1141
|
}
|
|
1101
1142
|
};
|
|
1102
|
-
Object.defineProperty(
|
|
1143
|
+
Object.defineProperty(X.prototype, Ze, {
|
|
1103
1144
|
value: !0,
|
|
1104
1145
|
enumerable: !1,
|
|
1105
1146
|
writable: !1,
|
|
@@ -1107,49 +1148,49 @@ Object.defineProperty(Z.prototype, Ke, {
|
|
|
1107
1148
|
});
|
|
1108
1149
|
//#endregion
|
|
1109
1150
|
//#region src/extension.ts
|
|
1110
|
-
function
|
|
1111
|
-
return
|
|
1151
|
+
function Z() {
|
|
1152
|
+
return X.prototype;
|
|
1112
1153
|
}
|
|
1113
|
-
function
|
|
1114
|
-
return typeof e == "object" && !!e && e[
|
|
1154
|
+
function Qe(e) {
|
|
1155
|
+
return typeof e == "object" && !!e && e[Ze] === !0;
|
|
1115
1156
|
}
|
|
1116
|
-
function
|
|
1117
|
-
let n = Object.getOwnPropertyDescriptor(
|
|
1118
|
-
Object.defineProperty(
|
|
1157
|
+
function Q(e, t) {
|
|
1158
|
+
let n = Object.getOwnPropertyDescriptor(Z(), e);
|
|
1159
|
+
Object.defineProperty(Z(), e, {
|
|
1119
1160
|
value: t,
|
|
1120
1161
|
enumerable: !1,
|
|
1121
1162
|
writable: n?.writable ?? !1,
|
|
1122
1163
|
configurable: !0
|
|
1123
1164
|
});
|
|
1124
1165
|
}
|
|
1125
|
-
function
|
|
1166
|
+
function $e(e, t, n) {
|
|
1126
1167
|
ne(t, "name", e), u(n, "implementation", e);
|
|
1127
1168
|
}
|
|
1128
|
-
function
|
|
1129
|
-
if (
|
|
1130
|
-
|
|
1169
|
+
function et(e, t) {
|
|
1170
|
+
if ($e("extend", e, t), e in Y([])) throw c("extend", `"${e}" already exists on IIterableLinq: use override() to replace it`);
|
|
1171
|
+
Q(e, t);
|
|
1131
1172
|
}
|
|
1132
|
-
function
|
|
1133
|
-
|
|
1173
|
+
function tt(e, t) {
|
|
1174
|
+
$e("override", e, t);
|
|
1134
1175
|
let n = e;
|
|
1135
|
-
if (!(n !== "constructor" && Object.prototype.hasOwnProperty.call(
|
|
1136
|
-
|
|
1176
|
+
if (!(n !== "constructor" && Object.prototype.hasOwnProperty.call(Z(), n))) throw c("override", `"${n}" is not a method of IIterableLinq: use extend() to add it`);
|
|
1177
|
+
Q(n, t);
|
|
1137
1178
|
}
|
|
1138
1179
|
//#endregion
|
|
1139
1180
|
//#region src/index.ts
|
|
1140
|
-
function
|
|
1141
|
-
return $(
|
|
1181
|
+
function nt() {
|
|
1182
|
+
return $(y());
|
|
1142
1183
|
}
|
|
1143
1184
|
function $(e) {
|
|
1144
|
-
return l(e, "from"),
|
|
1185
|
+
return l(e, "from"), Y(e);
|
|
1145
1186
|
}
|
|
1146
|
-
function
|
|
1147
|
-
if (typeof t == "number") return $(
|
|
1187
|
+
function rt(e, t, n) {
|
|
1188
|
+
if (typeof t == "number") return $(K(e, t, n));
|
|
1148
1189
|
if (n !== void 0) throw c("fromRange", "The \"options\" parameter must be the second argument when \"start\" is omitted");
|
|
1149
|
-
return $(
|
|
1190
|
+
return $(K(e, t));
|
|
1150
1191
|
}
|
|
1151
|
-
function
|
|
1152
|
-
return $(
|
|
1192
|
+
function it(e, t) {
|
|
1193
|
+
return $(Ee(e, t));
|
|
1153
1194
|
}
|
|
1154
1195
|
//#endregion
|
|
1155
|
-
export {
|
|
1196
|
+
export { Xe as Functions, D as Unit, nt as empty, et as extend, $ as from, rt as fromRange, Qe as isIterableLinq, tt as override, it as repeat, O as unit };
|