iterable-linq-utility 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +121 -8
- package/dist/index.d.ts +121 -8
- package/dist/iterable-linq-utility.js +164 -108
- package/dist/iterable-linq-utility.umd.cjs +1 -1
- package/package.json +9 -2
package/dist/index.d.cts
CHANGED
|
@@ -241,7 +241,9 @@ declare namespace Functions {
|
|
|
241
241
|
range,
|
|
242
242
|
reduce,
|
|
243
243
|
repeat_2 as repeat,
|
|
244
|
+
skip,
|
|
244
245
|
some,
|
|
246
|
+
take,
|
|
245
247
|
tap,
|
|
246
248
|
tapChain
|
|
247
249
|
}
|
|
@@ -433,6 +435,19 @@ export declare interface IIterableLinqBase<T> {
|
|
|
433
435
|
* @since 0.0.8
|
|
434
436
|
*/
|
|
435
437
|
min(comparer?: Comparer<T>): T | undefined;
|
|
438
|
+
/**
|
|
439
|
+
* Runs the chain and accumulates its values into a single result, starting from the first value.
|
|
440
|
+
* @operation `Action`
|
|
441
|
+
* @param reducer - called with the accumulator, each value from the second one and its index (starting at 1); returns the new accumulator
|
|
442
|
+
* @returns the final accumulator; the only value when the chain has one value, without calling `reducer`
|
|
443
|
+
* @throws Error if the chain is empty or if `reducer` is not a function
|
|
444
|
+
* @example
|
|
445
|
+
* ```ts
|
|
446
|
+
* IterableLinq.from([3, 7, 2]).reduce((acc, v) => (v > acc ? v : acc)); // 7
|
|
447
|
+
* ```
|
|
448
|
+
* @since 0.2.0
|
|
449
|
+
*/
|
|
450
|
+
reduce(reducer: Reducer<T, T>): T;
|
|
436
451
|
/**
|
|
437
452
|
* Runs the chain and accumulates its values into a single result.
|
|
438
453
|
* @operation `Action`
|
|
@@ -447,19 +462,57 @@ export declare interface IIterableLinqBase<T> {
|
|
|
447
462
|
* @since 0.0.10
|
|
448
463
|
*/
|
|
449
464
|
reduce<R>(neutralElement: R, reducer: Reducer<T, R>): R;
|
|
465
|
+
/**
|
|
466
|
+
* Lazily skips the first `count` values and yields the rest.
|
|
467
|
+
* @operation `Transformation`
|
|
468
|
+
* @param count - how many values to skip; must be a non-negative integer
|
|
469
|
+
* @returns a lazy, re-runnable chain of the remaining values
|
|
470
|
+
* @throws Error if `count` is negative, not an integer, `NaN` or `Infinity`
|
|
471
|
+
* @example
|
|
472
|
+
* ```ts
|
|
473
|
+
* IterableLinq.from([1, 2, 3, 4, 5]).skip(2).collectToArray(); // [3, 4, 5]
|
|
474
|
+
* ```
|
|
475
|
+
* @since 0.3.0
|
|
476
|
+
*/
|
|
477
|
+
skip(count: number): IIterableLinq<T>;
|
|
478
|
+
/**
|
|
479
|
+
* Runs the chain until its first value, then stops and closes the source.
|
|
480
|
+
* @operation `Action`
|
|
481
|
+
* @returns `true` if the chain contains a value; `false` when it is empty
|
|
482
|
+
* @example
|
|
483
|
+
* ```ts
|
|
484
|
+
* IterableLinq.from([1, 2, 3]).some(); // true
|
|
485
|
+
* ```
|
|
486
|
+
* @since 0.3.0
|
|
487
|
+
*/
|
|
488
|
+
some(): boolean;
|
|
450
489
|
/**
|
|
451
490
|
* Runs the chain until a value satisfies `predicate`, then stops and closes the source.
|
|
452
491
|
* @operation `Action`
|
|
453
|
-
* @param predicate - called with each value and its index
|
|
454
|
-
* @returns `true` if at least one value satisfies `predicate`; `false`
|
|
455
|
-
* @throws Error if `predicate` is not a function
|
|
492
|
+
* @param predicate - called with each value and its index; `undefined` checks only whether a value exists
|
|
493
|
+
* @returns `true` if at least one value satisfies `predicate`; `false` otherwise
|
|
494
|
+
* @throws Error if a provided `predicate` is not a function
|
|
456
495
|
* @example
|
|
457
496
|
* ```ts
|
|
458
497
|
* IterableLinq.from([1, 2, 3]).some(v => v > 2); // true
|
|
459
498
|
* ```
|
|
460
499
|
* @since 0.0.1
|
|
461
500
|
*/
|
|
462
|
-
some(predicate: Predicate<T>): boolean;
|
|
501
|
+
some(predicate: Predicate<T> | undefined): boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Yields the first `count` values, then closes the source.
|
|
504
|
+
* The source is never read past the `count`-th value, so `take` also ends an infinite chain.
|
|
505
|
+
* @operation `Transformation`
|
|
506
|
+
* @param count - how many values to yield; must be a non-negative integer
|
|
507
|
+
* @returns a new chain with at most `count` values
|
|
508
|
+
* @throws Error if `count` is negative, not an integer, `NaN` or `Infinity`
|
|
509
|
+
* @example
|
|
510
|
+
* ```ts
|
|
511
|
+
* IterableLinq.from([1, 2, 3, 4, 5]).take(3).collectToArray(); // [1, 2, 3]
|
|
512
|
+
* ```
|
|
513
|
+
* @since 0.3.0
|
|
514
|
+
*/
|
|
515
|
+
take(count: number): IIterableLinq<T>;
|
|
463
516
|
/**
|
|
464
517
|
* Calls `tapper` on each value as it flows through the chain, without changing it.
|
|
465
518
|
* If `tapper` throws, the source is closed and the error propagates.
|
|
@@ -702,6 +755,21 @@ declare function range(end: number, options?: IRangeOptions): Iterable<number>;
|
|
|
702
755
|
*/
|
|
703
756
|
declare function range(start: number, end: number, options?: IRangeOptions): Iterable<number>;
|
|
704
757
|
|
|
758
|
+
/**
|
|
759
|
+
* Accumulates the values of `iterable` into a single result, starting from the first value.
|
|
760
|
+
* @operation `Action`
|
|
761
|
+
* @param iterable - the source `Iterable`
|
|
762
|
+
* @param reducer - called with the accumulator, each value from the second one and its index (starting at 1); returns the new accumulator
|
|
763
|
+
* @returns the final accumulator; the only value when `iterable` has one value, without calling `reducer`
|
|
764
|
+
* @throws Error if `iterable` is missing, does not implement `[Symbol.iterator]` or is empty, or if `reducer` is not a function
|
|
765
|
+
* @example
|
|
766
|
+
* ```ts
|
|
767
|
+
* Functions.reduce([3, 7, 2], (acc, v) => (v > acc ? v : acc)); // 7
|
|
768
|
+
* ```
|
|
769
|
+
* @since 0.2.0
|
|
770
|
+
*/
|
|
771
|
+
declare function reduce<T>(iterable: Iterable<T>, reducer: Reducer<T, T>): T;
|
|
772
|
+
|
|
705
773
|
/**
|
|
706
774
|
* Accumulates the values of `iterable` into a single result.
|
|
707
775
|
* @operation `Action`
|
|
@@ -757,20 +825,65 @@ export declare function repeat<T>(value: T, count: number): IIterableLinq<T>;
|
|
|
757
825
|
*/
|
|
758
826
|
declare function repeat_2<T>(value: T, count: number): Iterable<T>;
|
|
759
827
|
|
|
828
|
+
/**
|
|
829
|
+
* Lazily skips the first `count` values and yields the rest.
|
|
830
|
+
* @operation `Transformation`
|
|
831
|
+
* @param iterable - the source `Iterable`
|
|
832
|
+
* @param count - how many values to skip; must be a non-negative integer
|
|
833
|
+
* @returns a lazy, re-runnable `Iterable` of the remaining values
|
|
834
|
+
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`, or if `count` is negative, not an integer, `NaN` or `Infinity`
|
|
835
|
+
* @example
|
|
836
|
+
* ```ts
|
|
837
|
+
* Array.from(Functions.skip([1, 2, 3, 4, 5], 2)); // [3, 4, 5]
|
|
838
|
+
* ```
|
|
839
|
+
* @since 0.3.0
|
|
840
|
+
*/
|
|
841
|
+
declare function skip<T>(iterable: Iterable<T>, count: number): Iterable<T>;
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Tells whether `iterable` contains a value; reads one value, then closes the source.
|
|
845
|
+
* @operation `Action`
|
|
846
|
+
* @param iterable - the source `Iterable`
|
|
847
|
+
* @returns `true` if `iterable` contains a value; `false` when it is empty
|
|
848
|
+
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`
|
|
849
|
+
* @example
|
|
850
|
+
* ```ts
|
|
851
|
+
* Functions.some([1, 2, 3]); // true
|
|
852
|
+
* ```
|
|
853
|
+
* @since 0.3.0
|
|
854
|
+
*/
|
|
855
|
+
declare function some<T>(iterable: Iterable<T>): boolean;
|
|
856
|
+
|
|
760
857
|
/**
|
|
761
858
|
* Tells whether at least one value satisfies `predicate`; stops and closes the source at the first match.
|
|
762
859
|
* @operation `Action`
|
|
763
860
|
* @param iterable - the source `Iterable`
|
|
764
|
-
* @param predicate - called with each value and its index
|
|
765
|
-
* @returns `true` if a value satisfies `predicate`; `false`
|
|
766
|
-
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`, or if `predicate` is not a function
|
|
861
|
+
* @param predicate - called with each value and its index; `undefined` checks only whether a value exists
|
|
862
|
+
* @returns `true` if a value satisfies `predicate`; `false` otherwise
|
|
863
|
+
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`, or if a provided `predicate` is not a function
|
|
767
864
|
* @example
|
|
768
865
|
* ```ts
|
|
769
866
|
* Functions.some([1, 2, 3], v => v > 2); // true
|
|
770
867
|
* ```
|
|
771
868
|
* @since 0.0.10
|
|
772
869
|
*/
|
|
773
|
-
declare function some<T>(iterable: Iterable<T>, predicate: Predicate<T>): boolean;
|
|
870
|
+
declare function some<T>(iterable: Iterable<T>, predicate: Predicate<T> | undefined): boolean;
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Lazily yields the first `count` values, then closes the source.
|
|
874
|
+
* The source is never read past the `count`-th value, so `take` also ends an infinite source.
|
|
875
|
+
* @operation `Transformation`
|
|
876
|
+
* @param iterable - the source `Iterable`
|
|
877
|
+
* @param count - how many values to yield; must be a non-negative integer
|
|
878
|
+
* @returns a lazy, re-runnable `Iterable` of at most `count` values
|
|
879
|
+
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`, or if `count` is negative, not an integer, `NaN` or `Infinity`
|
|
880
|
+
* @example
|
|
881
|
+
* ```ts
|
|
882
|
+
* Array.from(Functions.take([1, 2, 3, 4, 5], 3)); // [1, 2, 3]
|
|
883
|
+
* ```
|
|
884
|
+
* @since 0.3.0
|
|
885
|
+
*/
|
|
886
|
+
declare function take<T>(iterable: Iterable<T>, count: number): Iterable<T>;
|
|
774
887
|
|
|
775
888
|
/**
|
|
776
889
|
* Lazily calls `tapper` on each value as it flows through, without changing it.
|
package/dist/index.d.ts
CHANGED
|
@@ -241,7 +241,9 @@ declare namespace Functions {
|
|
|
241
241
|
range,
|
|
242
242
|
reduce,
|
|
243
243
|
repeat_2 as repeat,
|
|
244
|
+
skip,
|
|
244
245
|
some,
|
|
246
|
+
take,
|
|
245
247
|
tap,
|
|
246
248
|
tapChain
|
|
247
249
|
}
|
|
@@ -433,6 +435,19 @@ export declare interface IIterableLinqBase<T> {
|
|
|
433
435
|
* @since 0.0.8
|
|
434
436
|
*/
|
|
435
437
|
min(comparer?: Comparer<T>): T | undefined;
|
|
438
|
+
/**
|
|
439
|
+
* Runs the chain and accumulates its values into a single result, starting from the first value.
|
|
440
|
+
* @operation `Action`
|
|
441
|
+
* @param reducer - called with the accumulator, each value from the second one and its index (starting at 1); returns the new accumulator
|
|
442
|
+
* @returns the final accumulator; the only value when the chain has one value, without calling `reducer`
|
|
443
|
+
* @throws Error if the chain is empty or if `reducer` is not a function
|
|
444
|
+
* @example
|
|
445
|
+
* ```ts
|
|
446
|
+
* IterableLinq.from([3, 7, 2]).reduce((acc, v) => (v > acc ? v : acc)); // 7
|
|
447
|
+
* ```
|
|
448
|
+
* @since 0.2.0
|
|
449
|
+
*/
|
|
450
|
+
reduce(reducer: Reducer<T, T>): T;
|
|
436
451
|
/**
|
|
437
452
|
* Runs the chain and accumulates its values into a single result.
|
|
438
453
|
* @operation `Action`
|
|
@@ -447,19 +462,57 @@ export declare interface IIterableLinqBase<T> {
|
|
|
447
462
|
* @since 0.0.10
|
|
448
463
|
*/
|
|
449
464
|
reduce<R>(neutralElement: R, reducer: Reducer<T, R>): R;
|
|
465
|
+
/**
|
|
466
|
+
* Lazily skips the first `count` values and yields the rest.
|
|
467
|
+
* @operation `Transformation`
|
|
468
|
+
* @param count - how many values to skip; must be a non-negative integer
|
|
469
|
+
* @returns a lazy, re-runnable chain of the remaining values
|
|
470
|
+
* @throws Error if `count` is negative, not an integer, `NaN` or `Infinity`
|
|
471
|
+
* @example
|
|
472
|
+
* ```ts
|
|
473
|
+
* IterableLinq.from([1, 2, 3, 4, 5]).skip(2).collectToArray(); // [3, 4, 5]
|
|
474
|
+
* ```
|
|
475
|
+
* @since 0.3.0
|
|
476
|
+
*/
|
|
477
|
+
skip(count: number): IIterableLinq<T>;
|
|
478
|
+
/**
|
|
479
|
+
* Runs the chain until its first value, then stops and closes the source.
|
|
480
|
+
* @operation `Action`
|
|
481
|
+
* @returns `true` if the chain contains a value; `false` when it is empty
|
|
482
|
+
* @example
|
|
483
|
+
* ```ts
|
|
484
|
+
* IterableLinq.from([1, 2, 3]).some(); // true
|
|
485
|
+
* ```
|
|
486
|
+
* @since 0.3.0
|
|
487
|
+
*/
|
|
488
|
+
some(): boolean;
|
|
450
489
|
/**
|
|
451
490
|
* Runs the chain until a value satisfies `predicate`, then stops and closes the source.
|
|
452
491
|
* @operation `Action`
|
|
453
|
-
* @param predicate - called with each value and its index
|
|
454
|
-
* @returns `true` if at least one value satisfies `predicate`; `false`
|
|
455
|
-
* @throws Error if `predicate` is not a function
|
|
492
|
+
* @param predicate - called with each value and its index; `undefined` checks only whether a value exists
|
|
493
|
+
* @returns `true` if at least one value satisfies `predicate`; `false` otherwise
|
|
494
|
+
* @throws Error if a provided `predicate` is not a function
|
|
456
495
|
* @example
|
|
457
496
|
* ```ts
|
|
458
497
|
* IterableLinq.from([1, 2, 3]).some(v => v > 2); // true
|
|
459
498
|
* ```
|
|
460
499
|
* @since 0.0.1
|
|
461
500
|
*/
|
|
462
|
-
some(predicate: Predicate<T>): boolean;
|
|
501
|
+
some(predicate: Predicate<T> | undefined): boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Yields the first `count` values, then closes the source.
|
|
504
|
+
* The source is never read past the `count`-th value, so `take` also ends an infinite chain.
|
|
505
|
+
* @operation `Transformation`
|
|
506
|
+
* @param count - how many values to yield; must be a non-negative integer
|
|
507
|
+
* @returns a new chain with at most `count` values
|
|
508
|
+
* @throws Error if `count` is negative, not an integer, `NaN` or `Infinity`
|
|
509
|
+
* @example
|
|
510
|
+
* ```ts
|
|
511
|
+
* IterableLinq.from([1, 2, 3, 4, 5]).take(3).collectToArray(); // [1, 2, 3]
|
|
512
|
+
* ```
|
|
513
|
+
* @since 0.3.0
|
|
514
|
+
*/
|
|
515
|
+
take(count: number): IIterableLinq<T>;
|
|
463
516
|
/**
|
|
464
517
|
* Calls `tapper` on each value as it flows through the chain, without changing it.
|
|
465
518
|
* If `tapper` throws, the source is closed and the error propagates.
|
|
@@ -702,6 +755,21 @@ declare function range(end: number, options?: IRangeOptions): Iterable<number>;
|
|
|
702
755
|
*/
|
|
703
756
|
declare function range(start: number, end: number, options?: IRangeOptions): Iterable<number>;
|
|
704
757
|
|
|
758
|
+
/**
|
|
759
|
+
* Accumulates the values of `iterable` into a single result, starting from the first value.
|
|
760
|
+
* @operation `Action`
|
|
761
|
+
* @param iterable - the source `Iterable`
|
|
762
|
+
* @param reducer - called with the accumulator, each value from the second one and its index (starting at 1); returns the new accumulator
|
|
763
|
+
* @returns the final accumulator; the only value when `iterable` has one value, without calling `reducer`
|
|
764
|
+
* @throws Error if `iterable` is missing, does not implement `[Symbol.iterator]` or is empty, or if `reducer` is not a function
|
|
765
|
+
* @example
|
|
766
|
+
* ```ts
|
|
767
|
+
* Functions.reduce([3, 7, 2], (acc, v) => (v > acc ? v : acc)); // 7
|
|
768
|
+
* ```
|
|
769
|
+
* @since 0.2.0
|
|
770
|
+
*/
|
|
771
|
+
declare function reduce<T>(iterable: Iterable<T>, reducer: Reducer<T, T>): T;
|
|
772
|
+
|
|
705
773
|
/**
|
|
706
774
|
* Accumulates the values of `iterable` into a single result.
|
|
707
775
|
* @operation `Action`
|
|
@@ -757,20 +825,65 @@ export declare function repeat<T>(value: T, count: number): IIterableLinq<T>;
|
|
|
757
825
|
*/
|
|
758
826
|
declare function repeat_2<T>(value: T, count: number): Iterable<T>;
|
|
759
827
|
|
|
828
|
+
/**
|
|
829
|
+
* Lazily skips the first `count` values and yields the rest.
|
|
830
|
+
* @operation `Transformation`
|
|
831
|
+
* @param iterable - the source `Iterable`
|
|
832
|
+
* @param count - how many values to skip; must be a non-negative integer
|
|
833
|
+
* @returns a lazy, re-runnable `Iterable` of the remaining values
|
|
834
|
+
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`, or if `count` is negative, not an integer, `NaN` or `Infinity`
|
|
835
|
+
* @example
|
|
836
|
+
* ```ts
|
|
837
|
+
* Array.from(Functions.skip([1, 2, 3, 4, 5], 2)); // [3, 4, 5]
|
|
838
|
+
* ```
|
|
839
|
+
* @since 0.3.0
|
|
840
|
+
*/
|
|
841
|
+
declare function skip<T>(iterable: Iterable<T>, count: number): Iterable<T>;
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Tells whether `iterable` contains a value; reads one value, then closes the source.
|
|
845
|
+
* @operation `Action`
|
|
846
|
+
* @param iterable - the source `Iterable`
|
|
847
|
+
* @returns `true` if `iterable` contains a value; `false` when it is empty
|
|
848
|
+
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`
|
|
849
|
+
* @example
|
|
850
|
+
* ```ts
|
|
851
|
+
* Functions.some([1, 2, 3]); // true
|
|
852
|
+
* ```
|
|
853
|
+
* @since 0.3.0
|
|
854
|
+
*/
|
|
855
|
+
declare function some<T>(iterable: Iterable<T>): boolean;
|
|
856
|
+
|
|
760
857
|
/**
|
|
761
858
|
* Tells whether at least one value satisfies `predicate`; stops and closes the source at the first match.
|
|
762
859
|
* @operation `Action`
|
|
763
860
|
* @param iterable - the source `Iterable`
|
|
764
|
-
* @param predicate - called with each value and its index
|
|
765
|
-
* @returns `true` if a value satisfies `predicate`; `false`
|
|
766
|
-
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`, or if `predicate` is not a function
|
|
861
|
+
* @param predicate - called with each value and its index; `undefined` checks only whether a value exists
|
|
862
|
+
* @returns `true` if a value satisfies `predicate`; `false` otherwise
|
|
863
|
+
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`, or if a provided `predicate` is not a function
|
|
767
864
|
* @example
|
|
768
865
|
* ```ts
|
|
769
866
|
* Functions.some([1, 2, 3], v => v > 2); // true
|
|
770
867
|
* ```
|
|
771
868
|
* @since 0.0.10
|
|
772
869
|
*/
|
|
773
|
-
declare function some<T>(iterable: Iterable<T>, predicate: Predicate<T>): boolean;
|
|
870
|
+
declare function some<T>(iterable: Iterable<T>, predicate: Predicate<T> | undefined): boolean;
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Lazily yields the first `count` values, then closes the source.
|
|
874
|
+
* The source is never read past the `count`-th value, so `take` also ends an infinite source.
|
|
875
|
+
* @operation `Transformation`
|
|
876
|
+
* @param iterable - the source `Iterable`
|
|
877
|
+
* @param count - how many values to yield; must be a non-negative integer
|
|
878
|
+
* @returns a lazy, re-runnable `Iterable` of at most `count` values
|
|
879
|
+
* @throws Error if `iterable` is missing or does not implement `[Symbol.iterator]`, or if `count` is negative, not an integer, `NaN` or `Infinity`
|
|
880
|
+
* @example
|
|
881
|
+
* ```ts
|
|
882
|
+
* Array.from(Functions.take([1, 2, 3, 4, 5], 3)); // [1, 2, 3]
|
|
883
|
+
* ```
|
|
884
|
+
* @since 0.3.0
|
|
885
|
+
*/
|
|
886
|
+
declare function take<T>(iterable: Iterable<T>, count: number): Iterable<T>;
|
|
774
887
|
|
|
775
888
|
/**
|
|
776
889
|
* Lazily calls `tapper` on each value as it flows through, without changing it.
|
|
@@ -60,18 +60,18 @@ function l(e, t) {
|
|
|
60
60
|
function u(e, t) {
|
|
61
61
|
if (!Number.isInteger(e) || e < 0) throw Error(`The "${t}" parameter must be a non-negative integer`);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function ee(e, t) {
|
|
64
64
|
if (!Number.isFinite(e) || e === 0) throw Error(`The "${t}" parameter must be a finite number other than 0`);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function te(e, t) {
|
|
67
67
|
if (typeof e != "object" || !e) throw Error(`The "${t}" parameter must be an object`);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function ne(e, t) {
|
|
70
70
|
if (typeof e != "string" || e.length === 0) throw Error(`The "${t}" parameter must be a non-empty string`);
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/functions/collectToArray.ts
|
|
74
|
-
function
|
|
74
|
+
function d(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);
|
|
@@ -79,7 +79,7 @@ function f(e) {
|
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/iterators/baseIterator.ts
|
|
82
|
-
var
|
|
82
|
+
var f = class {
|
|
83
83
|
done = !1;
|
|
84
84
|
next() {
|
|
85
85
|
if (this.done) return s();
|
|
@@ -101,7 +101,7 @@ var p = class {
|
|
|
101
101
|
} catch {}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
},
|
|
104
|
+
}, p = class {
|
|
105
105
|
createIterator;
|
|
106
106
|
constructor(e) {
|
|
107
107
|
this.createIterator = e;
|
|
@@ -109,7 +109,7 @@ var p = class {
|
|
|
109
109
|
[Symbol.iterator]() {
|
|
110
110
|
return this.createIterator();
|
|
111
111
|
}
|
|
112
|
-
},
|
|
112
|
+
}, m = class extends f {
|
|
113
113
|
source;
|
|
114
114
|
index = 0;
|
|
115
115
|
constructor(e) {
|
|
@@ -121,10 +121,10 @@ var p = class {
|
|
|
121
121
|
};
|
|
122
122
|
//#endregion
|
|
123
123
|
//#region src/iterators/unfold.ts
|
|
124
|
-
function
|
|
125
|
-
return new
|
|
124
|
+
function h(e, t) {
|
|
125
|
+
return new p(() => new g(e, t));
|
|
126
126
|
}
|
|
127
|
-
var
|
|
127
|
+
var g = class extends f {
|
|
128
128
|
state;
|
|
129
129
|
step;
|
|
130
130
|
constructor(e, t) {
|
|
@@ -138,14 +138,14 @@ var ne = class extends p {
|
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region src/functions/empty.ts
|
|
140
140
|
function _() {
|
|
141
|
-
return
|
|
141
|
+
return h(void 0, () => void 0);
|
|
142
142
|
}
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region src/functions/filter.ts
|
|
145
145
|
function v(e, t) {
|
|
146
|
-
return c(e), l(t, "predicate"), new
|
|
146
|
+
return c(e), l(t, "predicate"), new p(() => new re(e, t));
|
|
147
147
|
}
|
|
148
|
-
var re = class extends
|
|
148
|
+
var re = class extends m {
|
|
149
149
|
predicate;
|
|
150
150
|
constructor(e, t) {
|
|
151
151
|
super(e), this.predicate = t;
|
|
@@ -166,9 +166,9 @@ var re = class extends h {
|
|
|
166
166
|
//#endregion
|
|
167
167
|
//#region src/functions/flatMap.ts
|
|
168
168
|
function y(e, t) {
|
|
169
|
-
return c(e), l(t, "mapper"), new
|
|
169
|
+
return c(e), l(t, "mapper"), new p(() => new ie(e, t));
|
|
170
170
|
}
|
|
171
|
-
var
|
|
171
|
+
var ie = class e extends m {
|
|
172
172
|
mapper;
|
|
173
173
|
static steps = {
|
|
174
174
|
outer: (t) => {
|
|
@@ -229,7 +229,7 @@ var b = class e extends h {
|
|
|
229
229
|
throw e.inner = void 0, e.closeAfterCallbackError(), t;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
},
|
|
232
|
+
}, b = class e {
|
|
233
233
|
static instance = e.createFrozen();
|
|
234
234
|
constructor() {}
|
|
235
235
|
static createFrozen() {
|
|
@@ -237,29 +237,29 @@ var b = class e extends h {
|
|
|
237
237
|
return Object.freeze(t), t;
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
|
-
function
|
|
241
|
-
return
|
|
240
|
+
function x() {
|
|
241
|
+
return b.instance;
|
|
242
242
|
}
|
|
243
243
|
//#endregion
|
|
244
244
|
//#region src/functions/forEach.ts
|
|
245
|
-
function
|
|
245
|
+
function S(e, t) {
|
|
246
246
|
c(e), l(t, "action");
|
|
247
247
|
let n = 0;
|
|
248
248
|
for (let r of e) t(r, n++);
|
|
249
|
-
return
|
|
249
|
+
return x();
|
|
250
250
|
}
|
|
251
|
-
async function
|
|
251
|
+
async function C(e, t) {
|
|
252
252
|
c(e), l(t, "action");
|
|
253
253
|
let n = 0;
|
|
254
254
|
for (let r of e) await t(r, n++);
|
|
255
|
-
return
|
|
255
|
+
return x();
|
|
256
256
|
}
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region src/functions/map.ts
|
|
259
|
-
function
|
|
260
|
-
return c(e), l(t, "mapper"), new
|
|
259
|
+
function w(e, t) {
|
|
260
|
+
return c(e), l(t, "mapper"), new p(() => new ae(e, t));
|
|
261
261
|
}
|
|
262
|
-
var
|
|
262
|
+
var ae = class extends m {
|
|
263
263
|
mapper;
|
|
264
264
|
constructor(e, t) {
|
|
265
265
|
super(e), this.mapper = t;
|
|
@@ -278,18 +278,18 @@ var ie = class extends h {
|
|
|
278
278
|
};
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region src/collections/linkedList.ts
|
|
281
|
-
function
|
|
281
|
+
function T(e) {
|
|
282
282
|
c(e);
|
|
283
|
-
let t = new
|
|
283
|
+
let t = new oe();
|
|
284
284
|
for (let n of e) t.addLast(n);
|
|
285
285
|
return t;
|
|
286
286
|
}
|
|
287
|
-
var
|
|
287
|
+
var oe = class {
|
|
288
288
|
internalSize = 0;
|
|
289
289
|
head = null;
|
|
290
290
|
tail = null;
|
|
291
291
|
[Symbol.iterator]() {
|
|
292
|
-
return new
|
|
292
|
+
return new se(this.head);
|
|
293
293
|
}
|
|
294
294
|
addFirst(e) {
|
|
295
295
|
let t = {
|
|
@@ -308,7 +308,7 @@ var D = class {
|
|
|
308
308
|
size() {
|
|
309
309
|
return this.internalSize;
|
|
310
310
|
}
|
|
311
|
-
},
|
|
311
|
+
}, se = class extends f {
|
|
312
312
|
current;
|
|
313
313
|
constructor(e) {
|
|
314
314
|
super(), this.current = e;
|
|
@@ -320,13 +320,13 @@ var D = class {
|
|
|
320
320
|
};
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region src/functions/materialize.ts
|
|
323
|
-
function
|
|
324
|
-
return c(e), e instanceof
|
|
323
|
+
function E(e) {
|
|
324
|
+
return c(e), e instanceof D ? e : new D(e);
|
|
325
325
|
}
|
|
326
|
-
var
|
|
326
|
+
var D = class {
|
|
327
327
|
source;
|
|
328
328
|
constructor(e) {
|
|
329
|
-
this.source =
|
|
329
|
+
this.source = T(e);
|
|
330
330
|
}
|
|
331
331
|
[Symbol.iterator]() {
|
|
332
332
|
return this.source[Symbol.iterator]();
|
|
@@ -334,29 +334,29 @@ var A = class {
|
|
|
334
334
|
};
|
|
335
335
|
//#endregion
|
|
336
336
|
//#region src/functions/max.ts
|
|
337
|
-
function
|
|
337
|
+
function O(e, t) {
|
|
338
338
|
return c(e), a(e, i(t), 1);
|
|
339
339
|
}
|
|
340
340
|
//#endregion
|
|
341
341
|
//#region src/functions/memoize.ts
|
|
342
|
-
function
|
|
342
|
+
function k() {
|
|
343
343
|
return { allowPartialMemoization: !0 };
|
|
344
344
|
}
|
|
345
|
-
function
|
|
345
|
+
function A(e, t) {
|
|
346
346
|
c(e);
|
|
347
347
|
let n = {
|
|
348
|
-
...
|
|
348
|
+
...k(),
|
|
349
349
|
...t
|
|
350
350
|
}.allowPartialMemoization;
|
|
351
|
-
return e instanceof
|
|
351
|
+
return e instanceof N ? n ? e.changePartialMemoizationBehaviour() : e : e instanceof P ? n ? e : e.changePartialMemoizationBehaviour() : n ? new P(e) : new N(e);
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function j() {
|
|
354
354
|
return {
|
|
355
355
|
values: [],
|
|
356
356
|
finished: !1
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function M(e, t) {
|
|
360
360
|
if (t.error) throw t.error.value;
|
|
361
361
|
if (t.finished) return !1;
|
|
362
362
|
t.source ??= e[Symbol.iterator]();
|
|
@@ -368,31 +368,31 @@ function F(e, t) {
|
|
|
368
368
|
}
|
|
369
369
|
return n.done === !0 ? (t.finished = !0, t.source = void 0, !1) : (t.values.push(n.value), !0);
|
|
370
370
|
}
|
|
371
|
-
var
|
|
371
|
+
var N = class {
|
|
372
372
|
source;
|
|
373
|
-
cache =
|
|
373
|
+
cache = j();
|
|
374
374
|
constructor(e) {
|
|
375
375
|
this.source = e;
|
|
376
376
|
}
|
|
377
377
|
[Symbol.iterator]() {
|
|
378
|
-
return new
|
|
378
|
+
return new F(this.source, this.cache, !0);
|
|
379
379
|
}
|
|
380
380
|
changePartialMemoizationBehaviour() {
|
|
381
|
-
return new
|
|
381
|
+
return new P(this.source);
|
|
382
382
|
}
|
|
383
|
-
},
|
|
383
|
+
}, P = class {
|
|
384
384
|
source;
|
|
385
|
-
cache =
|
|
385
|
+
cache = j();
|
|
386
386
|
constructor(e) {
|
|
387
387
|
this.source = e;
|
|
388
388
|
}
|
|
389
389
|
[Symbol.iterator]() {
|
|
390
|
-
return new
|
|
390
|
+
return new F(this.source, this.cache, !1);
|
|
391
391
|
}
|
|
392
392
|
changePartialMemoizationBehaviour() {
|
|
393
|
-
return new
|
|
393
|
+
return new N(this.source);
|
|
394
394
|
}
|
|
395
|
-
},
|
|
395
|
+
}, F = class extends f {
|
|
396
396
|
source;
|
|
397
397
|
cache;
|
|
398
398
|
drainFirst;
|
|
@@ -401,28 +401,28 @@ var I = class {
|
|
|
401
401
|
super(), this.source = e, this.cache = t, this.drainFirst = n;
|
|
402
402
|
}
|
|
403
403
|
advance() {
|
|
404
|
-
if (this.drainFirst) for (;
|
|
405
|
-
return this.index < this.cache.values.length ||
|
|
404
|
+
if (this.drainFirst) for (; M(this.source, this.cache););
|
|
405
|
+
return this.index < this.cache.values.length || M(this.source, this.cache) ? o(this.cache.values[this.index++]) : s();
|
|
406
406
|
}
|
|
407
407
|
};
|
|
408
408
|
//#endregion
|
|
409
409
|
//#region src/functions/min.ts
|
|
410
|
-
function
|
|
410
|
+
function I(e, t) {
|
|
411
411
|
return c(e), a(e, i(t), -1);
|
|
412
412
|
}
|
|
413
413
|
//#endregion
|
|
414
414
|
//#region src/functions/range.ts
|
|
415
|
-
function
|
|
415
|
+
function L(e, t, n) {
|
|
416
416
|
let r = typeof t == "number", i = r ? e : 0, a = r ? t : e;
|
|
417
417
|
if (!r && n !== void 0) throw Error("The \"options\" parameter must be the second argument when \"start\" is omitted");
|
|
418
418
|
let o = r ? n : t;
|
|
419
|
-
o !== void 0 &&
|
|
419
|
+
o !== void 0 && te(o, "options");
|
|
420
420
|
let { step: s = 1, reverse: c = !1 } = o ?? {};
|
|
421
|
-
|
|
422
|
-
let l =
|
|
423
|
-
return l.length > 0 ? new
|
|
421
|
+
ee(s, "step");
|
|
422
|
+
let l = ce(i, a, Math.abs(s), c);
|
|
423
|
+
return l.length > 0 ? new p(() => new le(l.first, l.step, l.length)) : _();
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function ce(e, t, n, r) {
|
|
426
426
|
let i = t < e ? -n : n, a = Math.ceil(Math.abs(t - e) / n);
|
|
427
427
|
return r ? {
|
|
428
428
|
first: e + (a - 1) * i,
|
|
@@ -434,7 +434,7 @@ function ae(e, t, n, r) {
|
|
|
434
434
|
length: a
|
|
435
435
|
};
|
|
436
436
|
}
|
|
437
|
-
var
|
|
437
|
+
var le = class extends f {
|
|
438
438
|
first;
|
|
439
439
|
step;
|
|
440
440
|
length;
|
|
@@ -448,31 +448,79 @@ var oe = class extends p {
|
|
|
448
448
|
};
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region src/functions/reduce.ts
|
|
451
|
-
function
|
|
452
|
-
c(e),
|
|
453
|
-
let r = t
|
|
454
|
-
|
|
455
|
-
|
|
451
|
+
function R(e, ...t) {
|
|
452
|
+
if (c(e), t.length === 1) return z(e, t[0]);
|
|
453
|
+
let [n, r] = t;
|
|
454
|
+
l(r, "reducer");
|
|
455
|
+
let i = n, a = 0;
|
|
456
|
+
for (let t of e) i = r(i, t, a++);
|
|
457
|
+
return i;
|
|
458
|
+
}
|
|
459
|
+
function z(e, t) {
|
|
460
|
+
l(t, "reducer");
|
|
461
|
+
let n, r = 0;
|
|
462
|
+
for (let i of e) n = r === 0 ? i : t(n, i, r), r++;
|
|
463
|
+
if (r === 0) throw Error("The \"sourceIterable\" must not be empty when \"reduce\" has no seed");
|
|
464
|
+
return n;
|
|
456
465
|
}
|
|
457
466
|
//#endregion
|
|
458
467
|
//#region src/functions/repeat.ts
|
|
459
|
-
function
|
|
460
|
-
return u(t, "count"),
|
|
468
|
+
function B(e, t) {
|
|
469
|
+
return u(t, "count"), h(t, (t) => t > 0 ? [e, t - 1] : void 0);
|
|
461
470
|
}
|
|
462
471
|
//#endregion
|
|
472
|
+
//#region src/functions/skip.ts
|
|
473
|
+
function V(e, t) {
|
|
474
|
+
return c(e), u(t, "count"), new p(() => new H(e, t));
|
|
475
|
+
}
|
|
476
|
+
var H = class extends m {
|
|
477
|
+
count;
|
|
478
|
+
constructor(e, t) {
|
|
479
|
+
super(e), this.count = t;
|
|
480
|
+
}
|
|
481
|
+
advance() {
|
|
482
|
+
for (; this.index < this.count;) {
|
|
483
|
+
let e = this.source.next();
|
|
484
|
+
if (e.done === !0) return e;
|
|
485
|
+
this.index++;
|
|
486
|
+
}
|
|
487
|
+
return this.source.next();
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
//#endregion
|
|
463
491
|
//#region src/functions/some.ts
|
|
464
492
|
function U(e, t) {
|
|
465
|
-
c(e),
|
|
493
|
+
if (c(e), t === void 0) {
|
|
494
|
+
for (let t of e) return !0;
|
|
495
|
+
return !1;
|
|
496
|
+
}
|
|
497
|
+
l(t, "predicate");
|
|
466
498
|
let n = 0;
|
|
467
499
|
for (let r of e) if (t(r, n++)) return !0;
|
|
468
500
|
return !1;
|
|
469
501
|
}
|
|
470
502
|
//#endregion
|
|
471
|
-
//#region src/functions/
|
|
503
|
+
//#region src/functions/take.ts
|
|
472
504
|
function W(e, t) {
|
|
473
|
-
return c(e),
|
|
505
|
+
return c(e), u(t, "count"), new p(() => new ue(e, t));
|
|
506
|
+
}
|
|
507
|
+
var ue = class extends m {
|
|
508
|
+
count;
|
|
509
|
+
constructor(e, t) {
|
|
510
|
+
super(e), this.count = t;
|
|
511
|
+
}
|
|
512
|
+
advance() {
|
|
513
|
+
if (this.index >= this.count) return this.source.return?.(), s();
|
|
514
|
+
let e = this.source.next();
|
|
515
|
+
return e.done === !0 ? e : (this.index++, o(e.value));
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/functions/tap.ts
|
|
520
|
+
function G(e, t) {
|
|
521
|
+
return c(e), l(t, "tapper"), new p(() => new de(e, t));
|
|
474
522
|
}
|
|
475
|
-
var
|
|
523
|
+
var de = class extends m {
|
|
476
524
|
tapper;
|
|
477
525
|
constructor(e, t) {
|
|
478
526
|
super(e), this.tapper = t;
|
|
@@ -491,28 +539,30 @@ var G = class extends h {
|
|
|
491
539
|
//#endregion
|
|
492
540
|
//#region src/functions/tapChain.ts
|
|
493
541
|
function K(e, t) {
|
|
494
|
-
return c(e), l(t, "tapper"), new
|
|
542
|
+
return c(e), l(t, "tapper"), new p(() => (t(e, 0), e[Symbol.iterator]()));
|
|
495
543
|
}
|
|
496
544
|
//#endregion
|
|
497
545
|
//#region src/functions/index.ts
|
|
498
|
-
var
|
|
499
|
-
collectToArray: () =>
|
|
546
|
+
var fe = /* @__PURE__ */ t({
|
|
547
|
+
collectToArray: () => d,
|
|
500
548
|
empty: () => _,
|
|
501
549
|
filter: () => v,
|
|
502
550
|
flatMap: () => y,
|
|
503
|
-
forEach: () =>
|
|
504
|
-
forEachAsync: () =>
|
|
505
|
-
getMemoizeDefaultOptions: () =>
|
|
506
|
-
map: () =>
|
|
507
|
-
materialize: () =>
|
|
508
|
-
max: () =>
|
|
509
|
-
memoize: () =>
|
|
510
|
-
min: () =>
|
|
511
|
-
range: () =>
|
|
512
|
-
reduce: () =>
|
|
513
|
-
repeat: () =>
|
|
551
|
+
forEach: () => S,
|
|
552
|
+
forEachAsync: () => C,
|
|
553
|
+
getMemoizeDefaultOptions: () => k,
|
|
554
|
+
map: () => w,
|
|
555
|
+
materialize: () => E,
|
|
556
|
+
max: () => O,
|
|
557
|
+
memoize: () => A,
|
|
558
|
+
min: () => I,
|
|
559
|
+
range: () => L,
|
|
560
|
+
reduce: () => R,
|
|
561
|
+
repeat: () => B,
|
|
562
|
+
skip: () => V,
|
|
514
563
|
some: () => U,
|
|
515
|
-
|
|
564
|
+
take: () => W,
|
|
565
|
+
tap: () => G,
|
|
516
566
|
tapChain: () => K
|
|
517
567
|
}), q = Symbol.for("iterable-linq-utility.IIterableLinq");
|
|
518
568
|
//#endregion
|
|
@@ -529,7 +579,7 @@ var Y = class {
|
|
|
529
579
|
return this.iterable[Symbol.iterator]();
|
|
530
580
|
}
|
|
531
581
|
collectToArray() {
|
|
532
|
-
return
|
|
582
|
+
return d(this.iterable);
|
|
533
583
|
}
|
|
534
584
|
filter(e) {
|
|
535
585
|
return J(v(this.iterable, e));
|
|
@@ -538,35 +588,41 @@ var Y = class {
|
|
|
538
588
|
return J(y(this.iterable, e));
|
|
539
589
|
}
|
|
540
590
|
forEach(e) {
|
|
541
|
-
return
|
|
591
|
+
return S(this.iterable, e);
|
|
542
592
|
}
|
|
543
593
|
forEachAsync(e) {
|
|
544
|
-
return
|
|
594
|
+
return C(this.iterable, e);
|
|
545
595
|
}
|
|
546
596
|
map(e) {
|
|
547
|
-
return J(
|
|
597
|
+
return J(w(this.iterable, e));
|
|
548
598
|
}
|
|
549
599
|
materialize() {
|
|
550
|
-
return J(
|
|
600
|
+
return J(E(this.iterable));
|
|
551
601
|
}
|
|
552
602
|
max(e) {
|
|
553
|
-
return
|
|
603
|
+
return O(this.iterable, e);
|
|
554
604
|
}
|
|
555
605
|
memoize(e) {
|
|
556
|
-
return J(
|
|
606
|
+
return J(A(this.iterable, e));
|
|
557
607
|
}
|
|
558
608
|
min(e) {
|
|
559
|
-
return
|
|
609
|
+
return I(this.iterable, e);
|
|
610
|
+
}
|
|
611
|
+
reduce(...e) {
|
|
612
|
+
return e.length === 1 ? R(this.iterable, e[0]) : R(this.iterable, e[0], e[1]);
|
|
560
613
|
}
|
|
561
|
-
|
|
562
|
-
return V(this.iterable, e
|
|
614
|
+
skip(e) {
|
|
615
|
+
return J(V(this.iterable, e));
|
|
563
616
|
}
|
|
564
617
|
some(e) {
|
|
565
618
|
return U(this.iterable, e);
|
|
566
619
|
}
|
|
567
|
-
|
|
620
|
+
take(e) {
|
|
568
621
|
return J(W(this.iterable, e));
|
|
569
622
|
}
|
|
623
|
+
tap(e) {
|
|
624
|
+
return J(G(this.iterable, e));
|
|
625
|
+
}
|
|
570
626
|
tapChain(e) {
|
|
571
627
|
return J(K(this.iterable, e));
|
|
572
628
|
}
|
|
@@ -587,7 +643,7 @@ Object.defineProperty(Y.prototype, q, {
|
|
|
587
643
|
function X() {
|
|
588
644
|
return Y.prototype;
|
|
589
645
|
}
|
|
590
|
-
function
|
|
646
|
+
function pe(e) {
|
|
591
647
|
return typeof e == "object" && !!e && e[q] === !0;
|
|
592
648
|
}
|
|
593
649
|
function Z(e, t) {
|
|
@@ -600,13 +656,13 @@ function Z(e, t) {
|
|
|
600
656
|
});
|
|
601
657
|
}
|
|
602
658
|
function Q(e, t) {
|
|
603
|
-
|
|
659
|
+
ne(e, "name"), l(t, "implementation");
|
|
604
660
|
}
|
|
605
|
-
function
|
|
661
|
+
function me(e, t) {
|
|
606
662
|
if (Q(e, t), e in J([])) throw Error(`"${e}" already exists on IIterableLinq: use override() to replace it`);
|
|
607
663
|
Z(e, t);
|
|
608
664
|
}
|
|
609
|
-
function
|
|
665
|
+
function he(e, t) {
|
|
610
666
|
Q(e, t);
|
|
611
667
|
let n = e;
|
|
612
668
|
if (!(n !== "constructor" && Object.prototype.hasOwnProperty.call(X(), n))) throw Error(`"${n}" is not a method of IIterableLinq: use extend() to add it`);
|
|
@@ -614,19 +670,19 @@ function ue(e, t) {
|
|
|
614
670
|
}
|
|
615
671
|
//#endregion
|
|
616
672
|
//#region src/index.ts
|
|
617
|
-
function
|
|
673
|
+
function ge() {
|
|
618
674
|
return $(_());
|
|
619
675
|
}
|
|
620
676
|
function $(e) {
|
|
621
677
|
return c(e), J(e);
|
|
622
678
|
}
|
|
623
|
-
function
|
|
624
|
-
if (typeof t == "number") return $(
|
|
679
|
+
function _e(e, t, n) {
|
|
680
|
+
if (typeof t == "number") return $(L(e, t, n));
|
|
625
681
|
if (n !== void 0) throw Error("The \"options\" parameter must be the second argument when \"start\" is omitted");
|
|
626
|
-
return $(
|
|
682
|
+
return $(L(e, t));
|
|
627
683
|
}
|
|
628
|
-
function
|
|
629
|
-
return $(
|
|
684
|
+
function ve(e, t) {
|
|
685
|
+
return $(B(e, t));
|
|
630
686
|
}
|
|
631
687
|
//#endregion
|
|
632
|
-
export {
|
|
688
|
+
export { fe as Functions, b as Unit, ge as empty, me as extend, $ as from, _e as fromRange, pe as isIterableLinq, he as override, ve as repeat, x as unit };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.IterableLinq={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r};function r(e){return typeof e==`function`}function i(e,t){return e<t?-1:e===t?0:1}function a(e){if(e==null)return i;if(r(e))return e;let t=Array.isArray(e)?e:[e];return(e,n)=>{for(let r of t){let t=i(e[r],n[r]);if(t!==0)return t}return 0}}function o(e,t,n){let r,i=!1;for(let a of e)!i||r==null&&a!=null?(r=a,i=!0):a!=null&&n*t(r,a)<0&&(r=a);return r}function s(e){return{done:!1,value:e}}function c(e){return{done:!0,value:e}}function l(e){if(e==null)throw Error(`The "sourceIterable" must be provided`);if(!r(e[Symbol.iterator]))throw Error(`The provided "sourceIterable" does not conform to the iterator protocol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol. It must implement the "[Symbol.iterator]" function.`)}function u(e,t){if(!r(e))throw Error(`The "${t}" function must be provided`)}function d(e,t){if(!Number.isInteger(e)||e<0)throw Error(`The "${t}" parameter must be a non-negative integer`)}function f(e,t){if(!Number.isFinite(e)||e===0)throw Error(`The "${t}" parameter must be a finite number other than 0`)}function p(e,t){if(typeof e!=`object`||!e)throw Error(`The "${t}" parameter must be an object`)}function ee(e,t){if(typeof e!=`string`||e.length===0)throw Error(`The "${t}" parameter must be a non-empty string`)}function m(e){if(l(e),Array.isArray(e)||e instanceof Set)return Array.from(e);let t=[];for(let n of e)t.push(n);return t}var h=class{done=!1;next(){if(this.done)return c();let e=this.advance();return e.done===!0&&(this.done=!0),e}return(e){return this.done||(this.done=!0,this.onReturn(e)),c(e)}[Symbol.iterator](){return this}onReturn(e){}closeAfterCallbackError(){if(!this.done){this.done=!0;try{this.onReturn()}catch{}}}},g=class{createIterator;constructor(e){this.createIterator=e}[Symbol.iterator](){return this.createIterator()}},_=class extends h{source;index=0;constructor(e){super(),this.source=e[Symbol.iterator]()}onReturn(e){this.source.return?.(e)}};function v(e,t){return new g(()=>new te(e,t))}var te=class extends h{state;step;constructor(e,t){super(),this.state=e,this.step=t}advance(){let e=this.step(this.state);return e===void 0?c():(this.state=e[1],s(e[0]))}};function y(){return v(void 0,()=>void 0)}function b(e,t){return l(e),u(t,`predicate`),new g(()=>new ne(e,t))}var ne=class extends _{predicate;constructor(e,t){super(e),this.predicate=t}advance(){for(let e=this.source.next();;e=this.source.next()){if(e.done===!0)return e;let t;try{t=this.predicate(e.value,this.index++)}catch(e){throw this.closeAfterCallbackError(),e}if(t)return e}}};function x(e,t){return l(e),u(t,`mapper`),new g(()=>new S(e,t))}var S=class e extends _{mapper;static steps={outer:t=>{let n=t.source.next();if(n.done===!0)return n;let r=e.mapNext(t,n.value);if(r===void 0){t.state=`inner`;return}if(r.length!==0)return t.array=r,t.position=1,t.state=`array`,s(r[0])},inner:t=>{let n=e.nextInner(t);if(n.done!==!0)return n;t.inner=void 0,t.state=`outer`},array:e=>{if(e.position<e.array.length)return s(e.array[e.position++]);e.array=void 0,e.state=`outer`}};state=`outer`;inner;array;position=0;constructor(e,t){super(e),this.mapper=t}advance(){for(;;){let t=e.steps[this.state](this);if(t!==void 0)return t}}onReturn(e){this.array=void 0;try{this.inner?.return?.(e)}finally{super.onReturn(e)}}static mapNext(e,t){try{let n=e.mapper(t,e.index++);if(Array.isArray(n))return n;e.inner=n[Symbol.iterator]();return}catch(t){throw e.closeAfterCallbackError(),t}}static nextInner(e){try{return e.inner.next()}catch(t){throw e.inner=void 0,e.closeAfterCallbackError(),t}}},C=class e{static instance=e.createFrozen();constructor(){}static createFrozen(){let t=new e;return Object.freeze(t),t}};function w(){return C.instance}function T(e,t){l(e),u(t,`action`);let n=0;for(let r of e)t(r,n++);return w()}async function E(e,t){l(e),u(t,`action`);let n=0;for(let r of e)await t(r,n++);return w()}function D(e,t){return l(e),u(t,`mapper`),new g(()=>new O(e,t))}var O=class extends _{mapper;constructor(e,t){super(e),this.mapper=t}advance(){let e=this.source.next();if(e.done===!0)return e;let t;try{t=this.mapper(e.value,this.index++)}catch(e){throw this.closeAfterCallbackError(),e}return s(t)}};function re(e){l(e);let t=new ie;for(let n of e)t.addLast(n);return t}var ie=class{internalSize=0;head=null;tail=null;[Symbol.iterator](){return new ae(this.head)}addFirst(e){let t={data:e,nextNode:this.head};return this.tail===null&&(this.tail=t),this.head=t,this.internalSize++,this}addLast(e){let t={data:e,nextNode:null};return this.tail===null?this.head=t:this.tail.nextNode=t,this.tail=t,this.internalSize++,this}size(){return this.internalSize}},ae=class extends h{current;constructor(e){super(),this.current=e}advance(){let e=this.current;return e===null?c():(this.current=e.nextNode,s(e.data))}};function k(e){return l(e),e instanceof A?e:new A(e)}var A=class{source;constructor(e){this.source=re(e)}[Symbol.iterator](){return this.source[Symbol.iterator]()}};function j(e,t){return l(e),o(e,a(t),1)}function M(){return{allowPartialMemoization:!0}}function N(e,t){l(e);let n={...M(),...t}.allowPartialMemoization;return e instanceof I?n?e.changePartialMemoizationBehaviour():e:e instanceof L?n?e:e.changePartialMemoizationBehaviour():n?new L(e):new I(e)}function P(){return{values:[],finished:!1}}function F(e,t){if(t.error)throw t.error.value;if(t.finished)return!1;t.source??=e[Symbol.iterator]();let n;try{n=t.source.next()}catch(e){throw t.error={value:e},t.source=void 0,e}return n.done===!0?(t.finished=!0,t.source=void 0,!1):(t.values.push(n.value),!0)}var I=class{source;cache=P();constructor(e){this.source=e}[Symbol.iterator](){return new R(this.source,this.cache,!0)}changePartialMemoizationBehaviour(){return new L(this.source)}},L=class{source;cache=P();constructor(e){this.source=e}[Symbol.iterator](){return new R(this.source,this.cache,!1)}changePartialMemoizationBehaviour(){return new I(this.source)}},R=class extends h{source;cache;drainFirst;index=0;constructor(e,t,n){super(),this.source=e,this.cache=t,this.drainFirst=n}advance(){if(this.drainFirst)for(;F(this.source,this.cache););return this.index<this.cache.values.length||F(this.source,this.cache)?s(this.cache.values[this.index++]):c()}};function z(e,t){return l(e),o(e,a(t),-1)}function B(e,t,n){let r=typeof t==`number`,i=r?e:0,a=r?t:e;if(!r&&n!==void 0)throw Error(`The "options" parameter must be the second argument when "start" is omitted`);let o=r?n:t;o!==void 0&&p(o,`options`);let{step:s=1,reverse:c=!1}=o??{};f(s,`step`);let l=oe(i,a,Math.abs(s),c);return l.length>0?new g(()=>new se(l.first,l.step,l.length)):y()}function oe(e,t,n,r){let i=t<e?-n:n,a=Math.ceil(Math.abs(t-e)/n);return r?{first:e+(a-1)*i,step:-i,length:a}:{first:e,step:i,length:a}}var se=class extends h{first;step;length;index=0;constructor(e,t,n){super(),this.first=e,this.step=t,this.length=n}advance(){return this.index>=this.length?c():s(this.first+this.index++*this.step)}};function V(e,t,n){l(e),u(n,`reducer`);let r=t,i=0;for(let t of e)r=n(r,t,i++);return r}function H(e,t){return d(t,`count`),v(t,t=>t>0?[e,t-1]:void 0)}function U(e,t){l(e),u(t,`predicate`);let n=0;for(let r of e)if(t(r,n++))return!0;return!1}function W(e,t){return l(e),u(t,`tapper`),new g(()=>new G(e,t))}var G=class extends _{tapper;constructor(e,t){super(e),this.tapper=t}advance(){let e=this.source.next();if(e.done===!0)return e;try{this.tapper(e.value,this.index++)}catch(e){throw this.closeAfterCallbackError(),e}return e}};function K(e,t){return l(e),u(t,`tapper`),new g(()=>(t(e,0),e[Symbol.iterator]()))}var ce=n({collectToArray:()=>m,empty:()=>y,filter:()=>b,flatMap:()=>x,forEach:()=>T,forEachAsync:()=>E,getMemoizeDefaultOptions:()=>M,map:()=>D,materialize:()=>k,max:()=>j,memoize:()=>N,min:()=>z,range:()=>B,reduce:()=>V,repeat:()=>H,some:()=>U,tap:()=>W,tapChain:()=>K}),q=Symbol.for(`iterable-linq-utility.IIterableLinq`);function J(e){return new Y(e)}var Y=class{iterable;constructor(e){this.iterable=e}[Symbol.iterator](){return this.iterable[Symbol.iterator]()}collectToArray(){return m(this.iterable)}filter(e){return J(b(this.iterable,e))}flatMap(e){return J(x(this.iterable,e))}forEach(e){return T(this.iterable,e)}forEachAsync(e){return E(this.iterable,e)}map(e){return J(D(this.iterable,e))}materialize(){return J(k(this.iterable))}max(e){return j(this.iterable,e)}memoize(e){return J(N(this.iterable,e))}min(e){return z(this.iterable,e)}reduce(e,t){return V(this.iterable,e,t)}some(e){return U(this.iterable,e)}tap(e){return J(W(this.iterable,e))}tapChain(e){return J(K(this.iterable,e))}tapChainCreation(e){u(e,`chainCreationTapper`);let t=this;return e(t),t}};Object.defineProperty(Y.prototype,q,{value:!0,enumerable:!1,writable:!1,configurable:!1});function X(){return Y.prototype}function le(e){return typeof e==`object`&&!!e&&e[q]===!0}function Z(e,t){let n=Object.getOwnPropertyDescriptor(X(),e);Object.defineProperty(X(),e,{value:t,enumerable:!1,writable:n?.writable??!1,configurable:!0})}function Q(e,t){ee(e,`name`),u(t,`implementation`)}function ue(e,t){if(Q(e,t),e in J([]))throw Error(`"${e}" already exists on IIterableLinq: use override() to replace it`);Z(e,t)}function de(e,t){Q(e,t);let n=e;if(!(n!==`constructor`&&Object.prototype.hasOwnProperty.call(X(),n)))throw Error(`"${n}" is not a method of IIterableLinq: use extend() to add it`);Z(n,t)}function fe(){return $(y())}function $(e){return l(e),J(e)}function pe(e,t,n){if(typeof t==`number`)return $(B(e,t,n));if(n!==void 0)throw Error(`The "options" parameter must be the second argument when "start" is omitted`);return $(B(e,t))}function me(e,t){return $(H(e,t))}Object.defineProperty(e,"Functions",{enumerable:!0,get:function(){return ce}}),e.Unit=C,e.empty=fe,e.extend=ue,e.from=$,e.fromRange=pe,e.isIterableLinq=le,e.override=de,e.repeat=me,e.unit=w});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.IterableLinq={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r};function r(e){return typeof e==`function`}function i(e,t){return e<t?-1:e===t?0:1}function a(e){if(e==null)return i;if(r(e))return e;let t=Array.isArray(e)?e:[e];return(e,n)=>{for(let r of t){let t=i(e[r],n[r]);if(t!==0)return t}return 0}}function o(e,t,n){let r,i=!1;for(let a of e)!i||r==null&&a!=null?(r=a,i=!0):a!=null&&n*t(r,a)<0&&(r=a);return r}function s(e){return{done:!1,value:e}}function c(e){return{done:!0,value:e}}function l(e){if(e==null)throw Error(`The "sourceIterable" must be provided`);if(!r(e[Symbol.iterator]))throw Error(`The provided "sourceIterable" does not conform to the iterator protocol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol. It must implement the "[Symbol.iterator]" function.`)}function u(e,t){if(!r(e))throw Error(`The "${t}" function must be provided`)}function d(e,t){if(!Number.isInteger(e)||e<0)throw Error(`The "${t}" parameter must be a non-negative integer`)}function f(e,t){if(!Number.isFinite(e)||e===0)throw Error(`The "${t}" parameter must be a finite number other than 0`)}function ee(e,t){if(typeof e!=`object`||!e)throw Error(`The "${t}" parameter must be an object`)}function te(e,t){if(typeof e!=`string`||e.length===0)throw Error(`The "${t}" parameter must be a non-empty string`)}function p(e){if(l(e),Array.isArray(e)||e instanceof Set)return Array.from(e);let t=[];for(let n of e)t.push(n);return t}var m=class{done=!1;next(){if(this.done)return c();let e=this.advance();return e.done===!0&&(this.done=!0),e}return(e){return this.done||(this.done=!0,this.onReturn(e)),c(e)}[Symbol.iterator](){return this}onReturn(e){}closeAfterCallbackError(){if(!this.done){this.done=!0;try{this.onReturn()}catch{}}}},h=class{createIterator;constructor(e){this.createIterator=e}[Symbol.iterator](){return this.createIterator()}},g=class extends m{source;index=0;constructor(e){super(),this.source=e[Symbol.iterator]()}onReturn(e){this.source.return?.(e)}};function _(e,t){return new h(()=>new ne(e,t))}var ne=class extends m{state;step;constructor(e,t){super(),this.state=e,this.step=t}advance(){let e=this.step(this.state);return e===void 0?c():(this.state=e[1],s(e[0]))}};function v(){return _(void 0,()=>void 0)}function y(e,t){return l(e),u(t,`predicate`),new h(()=>new re(e,t))}var re=class extends g{predicate;constructor(e,t){super(e),this.predicate=t}advance(){for(let e=this.source.next();;e=this.source.next()){if(e.done===!0)return e;let t;try{t=this.predicate(e.value,this.index++)}catch(e){throw this.closeAfterCallbackError(),e}if(t)return e}}};function b(e,t){return l(e),u(t,`mapper`),new h(()=>new ie(e,t))}var ie=class e extends g{mapper;static steps={outer:t=>{let n=t.source.next();if(n.done===!0)return n;let r=e.mapNext(t,n.value);if(r===void 0){t.state=`inner`;return}if(r.length!==0)return t.array=r,t.position=1,t.state=`array`,s(r[0])},inner:t=>{let n=e.nextInner(t);if(n.done!==!0)return n;t.inner=void 0,t.state=`outer`},array:e=>{if(e.position<e.array.length)return s(e.array[e.position++]);e.array=void 0,e.state=`outer`}};state=`outer`;inner;array;position=0;constructor(e,t){super(e),this.mapper=t}advance(){for(;;){let t=e.steps[this.state](this);if(t!==void 0)return t}}onReturn(e){this.array=void 0;try{this.inner?.return?.(e)}finally{super.onReturn(e)}}static mapNext(e,t){try{let n=e.mapper(t,e.index++);if(Array.isArray(n))return n;e.inner=n[Symbol.iterator]();return}catch(t){throw e.closeAfterCallbackError(),t}}static nextInner(e){try{return e.inner.next()}catch(t){throw e.inner=void 0,e.closeAfterCallbackError(),t}}},x=class e{static instance=e.createFrozen();constructor(){}static createFrozen(){let t=new e;return Object.freeze(t),t}};function S(){return x.instance}function C(e,t){l(e),u(t,`action`);let n=0;for(let r of e)t(r,n++);return S()}async function w(e,t){l(e),u(t,`action`);let n=0;for(let r of e)await t(r,n++);return S()}function T(e,t){return l(e),u(t,`mapper`),new h(()=>new ae(e,t))}var ae=class extends g{mapper;constructor(e,t){super(e),this.mapper=t}advance(){let e=this.source.next();if(e.done===!0)return e;let t;try{t=this.mapper(e.value,this.index++)}catch(e){throw this.closeAfterCallbackError(),e}return s(t)}};function oe(e){l(e);let t=new se;for(let n of e)t.addLast(n);return t}var se=class{internalSize=0;head=null;tail=null;[Symbol.iterator](){return new ce(this.head)}addFirst(e){let t={data:e,nextNode:this.head};return this.tail===null&&(this.tail=t),this.head=t,this.internalSize++,this}addLast(e){let t={data:e,nextNode:null};return this.tail===null?this.head=t:this.tail.nextNode=t,this.tail=t,this.internalSize++,this}size(){return this.internalSize}},ce=class extends m{current;constructor(e){super(),this.current=e}advance(){let e=this.current;return e===null?c():(this.current=e.nextNode,s(e.data))}};function E(e){return l(e),e instanceof D?e:new D(e)}var D=class{source;constructor(e){this.source=oe(e)}[Symbol.iterator](){return this.source[Symbol.iterator]()}};function O(e,t){return l(e),o(e,a(t),1)}function k(){return{allowPartialMemoization:!0}}function A(e,t){l(e);let n={...k(),...t}.allowPartialMemoization;return e instanceof N?n?e.changePartialMemoizationBehaviour():e:e instanceof P?n?e:e.changePartialMemoizationBehaviour():n?new P(e):new N(e)}function j(){return{values:[],finished:!1}}function M(e,t){if(t.error)throw t.error.value;if(t.finished)return!1;t.source??=e[Symbol.iterator]();let n;try{n=t.source.next()}catch(e){throw t.error={value:e},t.source=void 0,e}return n.done===!0?(t.finished=!0,t.source=void 0,!1):(t.values.push(n.value),!0)}var N=class{source;cache=j();constructor(e){this.source=e}[Symbol.iterator](){return new F(this.source,this.cache,!0)}changePartialMemoizationBehaviour(){return new P(this.source)}},P=class{source;cache=j();constructor(e){this.source=e}[Symbol.iterator](){return new F(this.source,this.cache,!1)}changePartialMemoizationBehaviour(){return new N(this.source)}},F=class extends m{source;cache;drainFirst;index=0;constructor(e,t,n){super(),this.source=e,this.cache=t,this.drainFirst=n}advance(){if(this.drainFirst)for(;M(this.source,this.cache););return this.index<this.cache.values.length||M(this.source,this.cache)?s(this.cache.values[this.index++]):c()}};function I(e,t){return l(e),o(e,a(t),-1)}function L(e,t,n){let r=typeof t==`number`,i=r?e:0,a=r?t:e;if(!r&&n!==void 0)throw Error(`The "options" parameter must be the second argument when "start" is omitted`);let o=r?n:t;o!==void 0&&ee(o,`options`);let{step:s=1,reverse:c=!1}=o??{};f(s,`step`);let l=le(i,a,Math.abs(s),c);return l.length>0?new h(()=>new ue(l.first,l.step,l.length)):v()}function le(e,t,n,r){let i=t<e?-n:n,a=Math.ceil(Math.abs(t-e)/n);return r?{first:e+(a-1)*i,step:-i,length:a}:{first:e,step:i,length:a}}var ue=class extends m{first;step;length;index=0;constructor(e,t,n){super(),this.first=e,this.step=t,this.length=n}advance(){return this.index>=this.length?c():s(this.first+this.index++*this.step)}};function R(e,...t){if(l(e),t.length===1)return de(e,t[0]);let[n,r]=t;u(r,`reducer`);let i=n,a=0;for(let t of e)i=r(i,t,a++);return i}function de(e,t){u(t,`reducer`);let n,r=0;for(let i of e)n=r===0?i:t(n,i,r),r++;if(r===0)throw Error(`The "sourceIterable" must not be empty when "reduce" has no seed`);return n}function z(e,t){return d(t,`count`),_(t,t=>t>0?[e,t-1]:void 0)}function B(e,t){return l(e),d(t,`count`),new h(()=>new V(e,t))}var V=class extends g{count;constructor(e,t){super(e),this.count=t}advance(){for(;this.index<this.count;){let e=this.source.next();if(e.done===!0)return e;this.index++}return this.source.next()}};function H(e,t){if(l(e),t===void 0){for(let t of e)return!0;return!1}u(t,`predicate`);let n=0;for(let r of e)if(t(r,n++))return!0;return!1}function U(e,t){return l(e),d(t,`count`),new h(()=>new fe(e,t))}var fe=class extends g{count;constructor(e,t){super(e),this.count=t}advance(){if(this.index>=this.count)return this.source.return?.(),c();let e=this.source.next();return e.done===!0?e:(this.index++,s(e.value))}};function W(e,t){return l(e),u(t,`tapper`),new h(()=>new pe(e,t))}var pe=class extends g{tapper;constructor(e,t){super(e),this.tapper=t}advance(){let e=this.source.next();if(e.done===!0)return e;try{this.tapper(e.value,this.index++)}catch(e){throw this.closeAfterCallbackError(),e}return e}};function G(e,t){return l(e),u(t,`tapper`),new h(()=>(t(e,0),e[Symbol.iterator]()))}var me=n({collectToArray:()=>p,empty:()=>v,filter:()=>y,flatMap:()=>b,forEach:()=>C,forEachAsync:()=>w,getMemoizeDefaultOptions:()=>k,map:()=>T,materialize:()=>E,max:()=>O,memoize:()=>A,min:()=>I,range:()=>L,reduce:()=>R,repeat:()=>z,skip:()=>B,some:()=>H,take:()=>U,tap:()=>W,tapChain:()=>G}),K=Symbol.for(`iterable-linq-utility.IIterableLinq`);function q(e){return new J(e)}var J=class{iterable;constructor(e){this.iterable=e}[Symbol.iterator](){return this.iterable[Symbol.iterator]()}collectToArray(){return p(this.iterable)}filter(e){return q(y(this.iterable,e))}flatMap(e){return q(b(this.iterable,e))}forEach(e){return C(this.iterable,e)}forEachAsync(e){return w(this.iterable,e)}map(e){return q(T(this.iterable,e))}materialize(){return q(E(this.iterable))}max(e){return O(this.iterable,e)}memoize(e){return q(A(this.iterable,e))}min(e){return I(this.iterable,e)}reduce(...e){return e.length===1?R(this.iterable,e[0]):R(this.iterable,e[0],e[1])}skip(e){return q(B(this.iterable,e))}some(e){return H(this.iterable,e)}take(e){return q(U(this.iterable,e))}tap(e){return q(W(this.iterable,e))}tapChain(e){return q(G(this.iterable,e))}tapChainCreation(e){u(e,`chainCreationTapper`);let t=this;return e(t),t}};Object.defineProperty(J.prototype,K,{value:!0,enumerable:!1,writable:!1,configurable:!1});function Y(){return J.prototype}function he(e){return typeof e==`object`&&!!e&&e[K]===!0}function X(e,t){let n=Object.getOwnPropertyDescriptor(Y(),e);Object.defineProperty(Y(),e,{value:t,enumerable:!1,writable:n?.writable??!1,configurable:!0})}function Z(e,t){te(e,`name`),u(t,`implementation`)}function Q(e,t){if(Z(e,t),e in q([]))throw Error(`"${e}" already exists on IIterableLinq: use override() to replace it`);X(e,t)}function ge(e,t){Z(e,t);let n=e;if(!(n!==`constructor`&&Object.prototype.hasOwnProperty.call(Y(),n)))throw Error(`"${n}" is not a method of IIterableLinq: use extend() to add it`);X(n,t)}function _e(){return $(v())}function $(e){return l(e),q(e)}function ve(e,t,n){if(typeof t==`number`)return $(L(e,t,n));if(n!==void 0)throw Error(`The "options" parameter must be the second argument when "start" is omitted`);return $(L(e,t))}function ye(e,t){return $(z(e,t))}Object.defineProperty(e,"Functions",{enumerable:!0,get:function(){return me}}),e.Unit=x,e.empty=_e,e.extend=Q,e.from=$,e.fromRange=ve,e.isIterableLinq=he,e.override=ge,e.repeat=ye,e.unit=S});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iterable-linq-utility",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "An Iterable mutation utility inspired by .net Linq and Javascript Array interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/iterable-linq-utility.umd.cjs",
|
|
@@ -24,9 +24,14 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc -p tsconfig.build.json && vite build && cp dist/index.d.ts dist/index.d.cts",
|
|
26
26
|
"check:package": "attw --pack .",
|
|
27
|
+
"check:changeset": "changeset status --since=origin/main",
|
|
28
|
+
"check:since": "node scripts/check-since.ts",
|
|
29
|
+
"check:instructions": "node scripts/check-instructions.ts",
|
|
30
|
+
"check:structure": "node scripts/check-structure.ts",
|
|
27
31
|
"dev": "vite",
|
|
28
32
|
"lint": "eslint .",
|
|
29
33
|
"lint-fix": "eslint . --fix",
|
|
34
|
+
"release:version": "changeset version && node scripts/set-since.ts",
|
|
30
35
|
"typecheck": "tsc -p tsconfig.test.json --noEmit",
|
|
31
36
|
"test": "vitest run",
|
|
32
37
|
"bench": "vite build --logLevel error && vitest bench --run",
|
|
@@ -51,6 +56,8 @@
|
|
|
51
56
|
],
|
|
52
57
|
"devDependencies": {
|
|
53
58
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
59
|
+
"@changesets/changelog-github": "^1.0.1",
|
|
60
|
+
"@changesets/cli": "^3.0.3",
|
|
54
61
|
"@eslint/js": "^10.0.1",
|
|
55
62
|
"@microsoft/api-extractor": "^7.59.2",
|
|
56
63
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
@@ -66,5 +73,5 @@
|
|
|
66
73
|
"vite-plugin-dts": "^5.1.1",
|
|
67
74
|
"vitest": "^5.0.2"
|
|
68
75
|
},
|
|
69
|
-
"packageManager": "pnpm@
|
|
76
|
+
"packageManager": "pnpm@12.8.1"
|
|
70
77
|
}
|