@daiso-tech/core 0.1.4 → 0.2.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 +1 -1
- package/dist/cjs/_shared/utilities.js +19 -0
- package/dist/cjs/_shared/utilities.js.map +1 -0
- package/dist/cjs/collection/_shared.js +4 -2
- package/dist/cjs/collection/_shared.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/_module.js +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-iterable.js +8 -7
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/{async-chunk-whilte-iterable.js → async-chunk-while-iterable.js} +14 -16
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -0
- package/dist/cjs/collection/async-iterable-collection/_shared/async-collapse-iterable.js +1 -2
- package/dist/cjs/collection/async-iterable-collection/_shared/async-collapse-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-count-by-iterable.js +3 -6
- package/dist/cjs/collection/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-cross-join-iterable.js +19 -18
- package/dist/cjs/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-entries-iterable.js +1 -8
- package/dist/cjs/collection/async-iterable-collection/_shared/async-entries-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-filter-iterable.js +6 -9
- package/dist/cjs/collection/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-flat-map-iterable.js +3 -6
- package/dist/cjs/collection/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-group-by-iterable.js +12 -13
- package/dist/cjs/collection/async-iterable-collection/_shared/async-group-by-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-after-iterable.js +5 -12
- package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-before-iterable.js +5 -12
- package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-map-iterable.js +3 -6
- package/dist/cjs/collection/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-merge-iterable.js +1 -2
- package/dist/cjs/collection/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-pad-end-iterable.js +1 -4
- package/dist/cjs/collection/async-iterable-collection/_shared/async-pad-end-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-pad-start-iterable.js +1 -4
- package/dist/cjs/collection/async-iterable-collection/_shared/async-pad-start-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-partion-iterable.js +12 -19
- package/dist/cjs/collection/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-repeat-iterable.js +2 -3
- package/dist/cjs/collection/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-reverse-iterable.js +3 -10
- package/dist/cjs/collection/async-iterable-collection/_shared/async-reverse-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-shuffle-iterable.js +4 -2
- package/dist/cjs/collection/async-iterable-collection/_shared/async-shuffle-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-iterable.js +4 -9
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-until-iterable.js +5 -12
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-slice-iterable.js +2 -4
- package/dist/cjs/collection/async-iterable-collection/_shared/async-slice-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-sliding-iterable.js +4 -11
- package/dist/cjs/collection/async-iterable-collection/_shared/async-sliding-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-split-iterable.js +7 -9
- package/dist/cjs/collection/async-iterable-collection/_shared/async-split-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-take-iterable.js +4 -9
- package/dist/cjs/collection/async-iterable-collection/_shared/async-take-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-take-until-iterable.js +6 -9
- package/dist/cjs/collection/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-tap-iterable.js +1 -2
- package/dist/cjs/collection/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-unique-iterable.js +2 -5
- package/dist/cjs/collection/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-update-iterable.js +6 -9
- package/dist/cjs/collection/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-when-iterable.js +1 -2
- package/dist/cjs/collection/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-zip-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js +173 -228
- package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/_module.js +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/_module.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/chunk-iterable.js +8 -7
- package/dist/cjs/collection/iterable-collection/_shared/chunk-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/{chunk-whilte-iterable.js → chunk-while-iterable.js} +12 -14
- package/dist/cjs/collection/iterable-collection/_shared/chunk-while-iterable.js.map +1 -0
- package/dist/cjs/collection/iterable-collection/_shared/collapse-iterable.js +1 -2
- package/dist/cjs/collection/iterable-collection/_shared/collapse-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/count-by-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/count-by-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js +26 -20
- package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/entries-iterable.js +2 -9
- package/dist/cjs/collection/iterable-collection/_shared/entries-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/filter-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/flat-map-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/group-by-iterable.js +10 -12
- package/dist/cjs/collection/iterable-collection/_shared/group-by-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/insert-after-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/insert-before-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/map-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/merge-iterable.js +1 -2
- package/dist/cjs/collection/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/pad-end-iterable.js +2 -6
- package/dist/cjs/collection/iterable-collection/_shared/pad-end-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/pad-start-iterable.js +2 -6
- package/dist/cjs/collection/iterable-collection/_shared/pad-start-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/partion-iterable.js +9 -11
- package/dist/cjs/collection/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/repeat-iterable.js +2 -3
- package/dist/cjs/collection/iterable-collection/_shared/repeat-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/reverse-iterable.js +4 -12
- package/dist/cjs/collection/iterable-collection/_shared/reverse-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/shuffle-iterable.js +5 -4
- package/dist/cjs/collection/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/skip-iterable.js +4 -9
- package/dist/cjs/collection/iterable-collection/_shared/skip-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/skip-until-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/slice-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/slice-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/sliding-iterable.js +4 -11
- package/dist/cjs/collection/iterable-collection/_shared/sliding-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/sort-iterable.js +1 -2
- package/dist/cjs/collection/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/split-iterable.js +7 -9
- package/dist/cjs/collection/iterable-collection/_shared/split-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/take-iterable.js +4 -9
- package/dist/cjs/collection/iterable-collection/_shared/take-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/take-until-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/tap-iterable.js +1 -2
- package/dist/cjs/collection/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/unique-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/update-iterable.js +3 -6
- package/dist/cjs/collection/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/when-iterable.js +1 -2
- package/dist/cjs/collection/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/zip-iterable.js +1 -2
- package/dist/cjs/collection/iterable-collection/_shared/zip-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/iterable-collection.js +161 -251
- package/dist/cjs/collection/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/cjs/collection/list-collection/list-collection.js +213 -299
- package/dist/cjs/collection/list-collection/list-collection.js.map +1 -1
- package/dist/cjs/contracts/collection/_shared.js +17 -10
- package/dist/cjs/contracts/collection/_shared.js.map +1 -1
- package/dist/esm/_shared/utilities.js +15 -0
- package/dist/esm/_shared/utilities.js.map +1 -0
- package/dist/esm/collection/_shared.js +4 -2
- package/dist/esm/collection/_shared.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/_module.js +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-iterable.js +8 -7
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js +37 -0
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -0
- package/dist/esm/collection/async-iterable-collection/_shared/async-collapse-iterable.js +1 -2
- package/dist/esm/collection/async-iterable-collection/_shared/async-collapse-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-count-by-iterable.js +3 -6
- package/dist/esm/collection/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-cross-join-iterable.js +19 -18
- package/dist/esm/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-entries-iterable.js +1 -8
- package/dist/esm/collection/async-iterable-collection/_shared/async-entries-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-filter-iterable.js +6 -9
- package/dist/esm/collection/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-flat-map-iterable.js +3 -6
- package/dist/esm/collection/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-group-by-iterable.js +12 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-group-by-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-insert-after-iterable.js +6 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-insert-before-iterable.js +6 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-map-iterable.js +3 -6
- package/dist/esm/collection/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-merge-iterable.js +1 -2
- package/dist/esm/collection/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-pad-end-iterable.js +1 -4
- package/dist/esm/collection/async-iterable-collection/_shared/async-pad-end-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-pad-start-iterable.js +1 -4
- package/dist/esm/collection/async-iterable-collection/_shared/async-pad-start-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-partion-iterable.js +13 -20
- package/dist/esm/collection/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-repeat-iterable.js +2 -3
- package/dist/esm/collection/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-reverse-iterable.js +3 -10
- package/dist/esm/collection/async-iterable-collection/_shared/async-reverse-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-shuffle-iterable.js +4 -2
- package/dist/esm/collection/async-iterable-collection/_shared/async-shuffle-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-iterable.js +4 -9
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-until-iterable.js +6 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-slice-iterable.js +2 -4
- package/dist/esm/collection/async-iterable-collection/_shared/async-slice-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-sliding-iterable.js +4 -11
- package/dist/esm/collection/async-iterable-collection/_shared/async-sliding-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-split-iterable.js +7 -9
- package/dist/esm/collection/async-iterable-collection/_shared/async-split-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-take-iterable.js +4 -9
- package/dist/esm/collection/async-iterable-collection/_shared/async-take-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-take-until-iterable.js +6 -9
- package/dist/esm/collection/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-tap-iterable.js +1 -2
- package/dist/esm/collection/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-unique-iterable.js +2 -5
- package/dist/esm/collection/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-update-iterable.js +6 -9
- package/dist/esm/collection/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-when-iterable.js +1 -2
- package/dist/esm/collection/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-zip-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js +174 -229
- package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/_module.js +1 -1
- package/dist/esm/collection/iterable-collection/_shared/_module.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/chunk-iterable.js +8 -7
- package/dist/esm/collection/iterable-collection/_shared/chunk-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/{chunk-whilte-iterable.js → chunk-while-iterable.js} +12 -14
- package/dist/esm/collection/iterable-collection/_shared/chunk-while-iterable.js.map +1 -0
- package/dist/esm/collection/iterable-collection/_shared/collapse-iterable.js +1 -2
- package/dist/esm/collection/iterable-collection/_shared/collapse-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/count-by-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/count-by-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js +24 -18
- package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/entries-iterable.js +3 -10
- package/dist/esm/collection/iterable-collection/_shared/entries-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/filter-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/flat-map-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/group-by-iterable.js +10 -12
- package/dist/esm/collection/iterable-collection/_shared/group-by-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/insert-after-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/insert-before-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/map-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/merge-iterable.js +1 -2
- package/dist/esm/collection/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/pad-end-iterable.js +2 -6
- package/dist/esm/collection/iterable-collection/_shared/pad-end-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/pad-start-iterable.js +2 -6
- package/dist/esm/collection/iterable-collection/_shared/pad-start-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/partion-iterable.js +9 -11
- package/dist/esm/collection/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/repeat-iterable.js +2 -3
- package/dist/esm/collection/iterable-collection/_shared/repeat-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/reverse-iterable.js +4 -12
- package/dist/esm/collection/iterable-collection/_shared/reverse-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/shuffle-iterable.js +5 -4
- package/dist/esm/collection/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/skip-iterable.js +4 -9
- package/dist/esm/collection/iterable-collection/_shared/skip-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/skip-until-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/slice-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/slice-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/sliding-iterable.js +4 -11
- package/dist/esm/collection/iterable-collection/_shared/sliding-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/sort-iterable.js +1 -2
- package/dist/esm/collection/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/split-iterable.js +7 -9
- package/dist/esm/collection/iterable-collection/_shared/split-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/take-iterable.js +4 -9
- package/dist/esm/collection/iterable-collection/_shared/take-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/take-until-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/tap-iterable.js +1 -2
- package/dist/esm/collection/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/unique-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/update-iterable.js +3 -6
- package/dist/esm/collection/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/when-iterable.js +1 -2
- package/dist/esm/collection/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/zip-iterable.js +1 -2
- package/dist/esm/collection/iterable-collection/_shared/zip-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/iterable-collection.js +162 -252
- package/dist/esm/collection/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/esm/collection/list-collection/list-collection.js +214 -300
- package/dist/esm/collection/list-collection/list-collection.js.map +1 -1
- package/dist/esm/contracts/collection/_shared.js +12 -6
- package/dist/esm/contracts/collection/_shared.js.map +1 -1
- package/dist/types/_shared/types.d.ts +5 -0
- package/dist/types/_shared/utilities.d.ts +3 -0
- package/dist/types/collection/async-iterable-collection/_shared/_module.d.ts +1 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-chunk-iterable.d.ts +2 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-chunk-while-iterable.d.ts +12 -0
- package/dist/types/collection/async-iterable-collection/_shared/async-count-by-iterable.d.ts +3 -3
- package/dist/types/collection/async-iterable-collection/_shared/async-cross-join-iterable.d.ts +6 -5
- package/dist/types/collection/async-iterable-collection/_shared/async-entries-iterable.d.ts +3 -4
- package/dist/types/collection/async-iterable-collection/_shared/async-filter-iterable.d.ts +2 -3
- package/dist/types/collection/async-iterable-collection/_shared/async-flat-map-iterable.d.ts +1 -2
- package/dist/types/collection/async-iterable-collection/_shared/async-group-by-iterable.d.ts +4 -4
- package/dist/types/collection/async-iterable-collection/_shared/async-insert-after-iterable.d.ts +4 -4
- package/dist/types/collection/async-iterable-collection/_shared/async-insert-before-iterable.d.ts +4 -4
- package/dist/types/collection/async-iterable-collection/_shared/async-map-iterable.d.ts +1 -2
- package/dist/types/collection/async-iterable-collection/_shared/async-merge-iterable.d.ts +1 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-pad-end-iterable.d.ts +2 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-pad-start-iterable.d.ts +2 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-partion-iterable.d.ts +4 -4
- package/dist/types/collection/async-iterable-collection/_shared/async-repeat-iterable.d.ts +2 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-reverse-iterable.d.ts +3 -3
- package/dist/types/collection/async-iterable-collection/_shared/async-shuffle-iterable.d.ts +2 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-skip-iterable.d.ts +1 -2
- package/dist/types/collection/async-iterable-collection/_shared/async-skip-until-iterable.d.ts +2 -3
- package/dist/types/collection/async-iterable-collection/_shared/async-slice-iterable.d.ts +1 -2
- package/dist/types/collection/async-iterable-collection/_shared/async-sliding-iterable.d.ts +1 -2
- package/dist/types/collection/async-iterable-collection/_shared/async-split-iterable.d.ts +3 -3
- package/dist/types/collection/async-iterable-collection/_shared/async-take-iterable.d.ts +1 -2
- package/dist/types/collection/async-iterable-collection/_shared/async-take-until-iterable.d.ts +2 -3
- package/dist/types/collection/async-iterable-collection/_shared/async-unique-iterable.d.ts +1 -2
- package/dist/types/collection/async-iterable-collection/_shared/async-update-iterable.d.ts +5 -6
- package/dist/types/collection/async-iterable-collection/_shared/async-zip-iterable.d.ts +2 -1
- package/dist/types/collection/async-iterable-collection/async-iterable-collection.d.ts +56 -54
- package/dist/types/collection/iterable-collection/_shared/_module.d.ts +1 -1
- package/dist/types/collection/iterable-collection/_shared/{chunk-whilte-iterable.d.ts → chunk-while-iterable.d.ts} +1 -2
- package/dist/types/collection/iterable-collection/_shared/count-by-iterable.d.ts +3 -3
- package/dist/types/collection/iterable-collection/_shared/cross-join-iterable.d.ts +5 -8
- package/dist/types/collection/iterable-collection/_shared/entries-iterable.d.ts +2 -3
- package/dist/types/collection/iterable-collection/_shared/filter-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/flat-map-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/group-by-iterable.d.ts +3 -3
- package/dist/types/collection/iterable-collection/_shared/insert-after-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/insert-before-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/map-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/partion-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/reverse-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/shuffle-iterable.d.ts +2 -1
- package/dist/types/collection/iterable-collection/_shared/skip-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/skip-until-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/slice-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/sliding-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/split-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/take-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/take-until-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/unique-iterable.d.ts +1 -2
- package/dist/types/collection/iterable-collection/_shared/update-iterable.d.ts +4 -5
- package/dist/types/collection/iterable-collection/_shared/zip-iterable.d.ts +1 -1
- package/dist/types/collection/iterable-collection/iterable-collection.d.ts +56 -54
- package/dist/types/collection/list-collection/list-collection.d.ts +57 -54
- package/dist/types/contracts/collection/_shared.d.ts +14 -158
- package/dist/types/contracts/collection/async-collection.contract.d.ts +430 -284
- package/dist/types/contracts/collection/collection.contract.d.ts +417 -260
- package/package.json +2 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-whilte-iterable.js.map +0 -1
- package/dist/cjs/collection/iterable-collection/_shared/chunk-whilte-iterable.js.map +0 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-whilte-iterable.js +0 -39
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-whilte-iterable.js.map +0 -1
- package/dist/esm/collection/iterable-collection/_shared/chunk-whilte-iterable.js.map +0 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-chunk-whilte-iterable.d.ts +0 -12
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AsyncIterableCollection = void 0;
|
|
4
4
|
const _module_1 = require("../../contracts/collection/_module");
|
|
5
5
|
const _module_2 = require("../../collection/async-iterable-collection/_shared/_module");
|
|
6
|
+
const utilities_1 = require("../../_shared/utilities");
|
|
6
7
|
class AsyncIterableCollection {
|
|
7
8
|
iterable;
|
|
8
|
-
static THROW_ON_NUMBER_LIMIT = false;
|
|
9
9
|
static DEFAULT_CHUNK_SIZE = 1024;
|
|
10
10
|
static makeCollection = (iterable) => {
|
|
11
11
|
return new AsyncIterableCollection(iterable);
|
|
@@ -19,92 +19,91 @@ class AsyncIterableCollection {
|
|
|
19
19
|
toIterator() {
|
|
20
20
|
return this[Symbol.asyncIterator]();
|
|
21
21
|
}
|
|
22
|
-
entries(
|
|
23
|
-
return new AsyncIterableCollection(new _module_2.AsyncEntriesIterable(this
|
|
22
|
+
entries() {
|
|
23
|
+
return new AsyncIterableCollection(new _module_2.AsyncEntriesIterable(this));
|
|
24
24
|
}
|
|
25
|
-
keys(
|
|
26
|
-
return this.entries(
|
|
25
|
+
keys() {
|
|
26
|
+
return this.entries().map(([key]) => key);
|
|
27
27
|
}
|
|
28
28
|
values() {
|
|
29
29
|
return this.entries().map(([_key, value]) => value);
|
|
30
30
|
}
|
|
31
|
-
filter(
|
|
32
|
-
return new AsyncIterableCollection(new _module_2.AsyncFilterIterable(this,
|
|
31
|
+
filter(predicateFn) {
|
|
32
|
+
return new AsyncIterableCollection(new _module_2.AsyncFilterIterable(this, predicateFn));
|
|
33
33
|
}
|
|
34
|
-
reject(
|
|
35
|
-
return this.filter(async (...arguments_) => !(await
|
|
34
|
+
reject(predicateFn) {
|
|
35
|
+
return this.filter(async (...arguments_) => !(await predicateFn(...arguments_)));
|
|
36
36
|
}
|
|
37
|
-
map(mapFn
|
|
38
|
-
return new AsyncIterableCollection(new _module_2.AsyncMapIterable(this, mapFn
|
|
37
|
+
map(mapFn) {
|
|
38
|
+
return new AsyncIterableCollection(new _module_2.AsyncMapIterable(this, mapFn));
|
|
39
39
|
}
|
|
40
|
-
async reduce(
|
|
41
|
-
const { reduceFn: reduce, initialValue, throwOnIndexOverflow, } = settings;
|
|
40
|
+
async reduce(reduceFn, initialValue) {
|
|
42
41
|
if (initialValue === undefined && (await this.isEmpty())) {
|
|
43
|
-
throw new
|
|
42
|
+
throw new _module_1.TypeCollectionError("Reduce of empty array must be inputed a initial value");
|
|
44
43
|
}
|
|
45
44
|
if (initialValue !== undefined) {
|
|
46
45
|
let output = initialValue;
|
|
47
46
|
for await (const [index, item] of this.entries()) {
|
|
48
|
-
output = await
|
|
47
|
+
output = await reduceFn(output, item, index, this);
|
|
49
48
|
}
|
|
50
49
|
return output;
|
|
51
50
|
}
|
|
52
51
|
let output = (await this.firstOrFail()), index = 0, isFirstIteration = true;
|
|
53
52
|
for await (const item of this) {
|
|
54
53
|
if (!isFirstIteration) {
|
|
55
|
-
|
|
56
|
-
throw new _module_1.IndexOverflowError("Index has overflowed");
|
|
57
|
-
}
|
|
58
|
-
output = await reduce(output, item, index, this);
|
|
54
|
+
output = await reduceFn(output, item, index, this);
|
|
59
55
|
}
|
|
60
56
|
isFirstIteration = false;
|
|
61
57
|
index++;
|
|
62
58
|
}
|
|
63
59
|
return output;
|
|
64
60
|
}
|
|
65
|
-
async join(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
async join(separator = ",") {
|
|
62
|
+
let str = null;
|
|
63
|
+
for await (const item of this) {
|
|
64
|
+
if (typeof item !== "string") {
|
|
65
|
+
throw new _module_1.TypeCollectionError("Item type is invalid must be string");
|
|
66
|
+
}
|
|
67
|
+
if (str === null) {
|
|
68
|
+
str = item;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
str = str + separator + item;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return str;
|
|
77
75
|
}
|
|
78
76
|
collapse() {
|
|
79
77
|
return new AsyncIterableCollection(new _module_2.AsyncCollapseIterable(this));
|
|
80
78
|
}
|
|
81
|
-
flatMap(mapFn
|
|
82
|
-
return new AsyncIterableCollection(new _module_2.AsyncFlatMapIterable(this, mapFn
|
|
79
|
+
flatMap(mapFn) {
|
|
80
|
+
return new AsyncIterableCollection(new _module_2.AsyncFlatMapIterable(this, mapFn));
|
|
83
81
|
}
|
|
84
|
-
|
|
85
|
-
return new AsyncIterableCollection(new _module_2.AsyncUpdateIterable(this,
|
|
82
|
+
change(predicateFn, mapFn) {
|
|
83
|
+
return new AsyncIterableCollection(new _module_2.AsyncUpdateIterable(this, predicateFn, mapFn));
|
|
86
84
|
}
|
|
87
|
-
page(
|
|
88
|
-
const { page, pageSize, throwOnIndexOverflow } = settings;
|
|
85
|
+
page(page, pageSize) {
|
|
89
86
|
if (page < 0) {
|
|
90
|
-
return this.skip(page * pageSize
|
|
87
|
+
return this.skip(page * pageSize).take(pageSize);
|
|
91
88
|
}
|
|
92
|
-
return this.skip((page - 1) * pageSize
|
|
89
|
+
return this.skip((page - 1) * pageSize).take(pageSize);
|
|
93
90
|
}
|
|
94
91
|
async sum() {
|
|
95
92
|
try {
|
|
93
|
+
if (await this.isEmpty()) {
|
|
94
|
+
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
95
|
+
}
|
|
96
96
|
let sum = 0;
|
|
97
97
|
for await (const item of this) {
|
|
98
98
|
if (typeof item !== "number") {
|
|
99
|
-
throw new
|
|
99
|
+
throw new _module_1.TypeCollectionError("Item type is invalid must be number");
|
|
100
100
|
}
|
|
101
101
|
sum += item;
|
|
102
102
|
}
|
|
103
103
|
return sum;
|
|
104
104
|
}
|
|
105
105
|
catch (error) {
|
|
106
|
-
if (error instanceof _module_1.CollectionError
|
|
107
|
-
error instanceof TypeError) {
|
|
106
|
+
if (error instanceof _module_1.CollectionError) {
|
|
108
107
|
throw error;
|
|
109
108
|
}
|
|
110
109
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
@@ -112,10 +111,13 @@ class AsyncIterableCollection {
|
|
|
112
111
|
}
|
|
113
112
|
async average() {
|
|
114
113
|
try {
|
|
114
|
+
if (await this.isEmpty()) {
|
|
115
|
+
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
116
|
+
}
|
|
115
117
|
let size = 0, sum = 0;
|
|
116
118
|
for await (const item of this) {
|
|
117
119
|
if (typeof item !== "number") {
|
|
118
|
-
throw new
|
|
120
|
+
throw new _module_1.TypeCollectionError("Item type is invalid must be number");
|
|
119
121
|
}
|
|
120
122
|
size++;
|
|
121
123
|
sum += item;
|
|
@@ -123,33 +125,32 @@ class AsyncIterableCollection {
|
|
|
123
125
|
return (sum / size);
|
|
124
126
|
}
|
|
125
127
|
catch (error) {
|
|
126
|
-
if (error instanceof _module_1.CollectionError
|
|
127
|
-
error instanceof TypeError) {
|
|
128
|
+
if (error instanceof _module_1.CollectionError) {
|
|
128
129
|
throw error;
|
|
129
130
|
}
|
|
130
131
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
|
-
async median(
|
|
134
|
+
async median() {
|
|
134
135
|
if (await this.isEmpty()) {
|
|
135
|
-
|
|
136
|
+
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
136
137
|
}
|
|
137
|
-
const size = await this.size(
|
|
138
|
+
const size = await this.size();
|
|
138
139
|
if (size === 0) {
|
|
139
140
|
return 0;
|
|
140
141
|
}
|
|
141
142
|
const isEven = size % 2 === 0, items = await this.map((item) => {
|
|
142
143
|
if (typeof item !== "number") {
|
|
143
|
-
throw new
|
|
144
|
+
throw new _module_1.TypeCollectionError("Item type is invalid must be number");
|
|
144
145
|
}
|
|
145
146
|
return item;
|
|
146
|
-
}
|
|
147
|
+
})
|
|
147
148
|
.filter((_item, index) => {
|
|
148
149
|
if (isEven) {
|
|
149
150
|
return index === size / 2 || index === size / 2 - 1;
|
|
150
151
|
}
|
|
151
152
|
return index === Math.floor(size / 2);
|
|
152
|
-
}
|
|
153
|
+
})
|
|
153
154
|
.toArray();
|
|
154
155
|
if (isEven) {
|
|
155
156
|
const [a, b] = items;
|
|
@@ -169,10 +170,13 @@ class AsyncIterableCollection {
|
|
|
169
170
|
}
|
|
170
171
|
async min() {
|
|
171
172
|
try {
|
|
173
|
+
if (await this.isEmpty()) {
|
|
174
|
+
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
175
|
+
}
|
|
172
176
|
let min = 0;
|
|
173
177
|
for await (const item of this) {
|
|
174
178
|
if (typeof item !== "number") {
|
|
175
|
-
throw new
|
|
179
|
+
throw new _module_1.TypeCollectionError("Item type is invalid must be number");
|
|
176
180
|
}
|
|
177
181
|
if (min === 0) {
|
|
178
182
|
min = item;
|
|
@@ -184,8 +188,7 @@ class AsyncIterableCollection {
|
|
|
184
188
|
return min;
|
|
185
189
|
}
|
|
186
190
|
catch (error) {
|
|
187
|
-
if (error instanceof _module_1.CollectionError
|
|
188
|
-
error instanceof TypeError) {
|
|
191
|
+
if (error instanceof _module_1.CollectionError) {
|
|
189
192
|
throw error;
|
|
190
193
|
}
|
|
191
194
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
@@ -193,10 +196,13 @@ class AsyncIterableCollection {
|
|
|
193
196
|
}
|
|
194
197
|
async max() {
|
|
195
198
|
try {
|
|
199
|
+
if (await this.isEmpty()) {
|
|
200
|
+
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
201
|
+
}
|
|
196
202
|
let max = 0;
|
|
197
203
|
for await (const item of this) {
|
|
198
204
|
if (typeof item !== "number") {
|
|
199
|
-
throw new
|
|
205
|
+
throw new _module_1.TypeCollectionError("Item type is invalid must be number");
|
|
200
206
|
}
|
|
201
207
|
if (max === 0) {
|
|
202
208
|
max = item;
|
|
@@ -208,24 +214,20 @@ class AsyncIterableCollection {
|
|
|
208
214
|
return max;
|
|
209
215
|
}
|
|
210
216
|
catch (error) {
|
|
211
|
-
if (error instanceof _module_1.CollectionError
|
|
212
|
-
error instanceof TypeError) {
|
|
217
|
+
if (error instanceof _module_1.CollectionError) {
|
|
213
218
|
throw error;
|
|
214
219
|
}
|
|
215
220
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
216
221
|
}
|
|
217
222
|
}
|
|
218
|
-
async percentage(
|
|
223
|
+
async percentage(predicateFn) {
|
|
219
224
|
try {
|
|
220
225
|
if (await this.isEmpty()) {
|
|
221
|
-
|
|
226
|
+
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
222
227
|
}
|
|
223
228
|
let part = 0, total = 0;
|
|
224
229
|
for await (const item of this) {
|
|
225
|
-
if (
|
|
226
|
-
throw new _module_1.IndexOverflowError("The total amount has overflowed");
|
|
227
|
-
}
|
|
228
|
-
if (await filter(item, total, this)) {
|
|
230
|
+
if (await predicateFn(item, total, this)) {
|
|
229
231
|
part++;
|
|
230
232
|
}
|
|
231
233
|
total++;
|
|
@@ -233,35 +235,33 @@ class AsyncIterableCollection {
|
|
|
233
235
|
return (part / total) * 100;
|
|
234
236
|
}
|
|
235
237
|
catch (error) {
|
|
236
|
-
if (error instanceof _module_1.CollectionError
|
|
237
|
-
error instanceof TypeError) {
|
|
238
|
+
if (error instanceof _module_1.CollectionError) {
|
|
238
239
|
throw error;
|
|
239
240
|
}
|
|
240
241
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
|
-
async some(
|
|
244
|
+
async some(predicateFn) {
|
|
244
245
|
try {
|
|
245
|
-
for await (const [index, item] of this.entries(
|
|
246
|
-
if (await
|
|
246
|
+
for await (const [index, item] of this.entries()) {
|
|
247
|
+
if (await predicateFn(item, index, this)) {
|
|
247
248
|
return true;
|
|
248
249
|
}
|
|
249
250
|
}
|
|
250
251
|
return false;
|
|
251
252
|
}
|
|
252
253
|
catch (error) {
|
|
253
|
-
if (error instanceof _module_1.CollectionError
|
|
254
|
-
error instanceof TypeError) {
|
|
254
|
+
if (error instanceof _module_1.CollectionError) {
|
|
255
255
|
throw error;
|
|
256
256
|
}
|
|
257
257
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
async every(
|
|
260
|
+
async every(predicateFn) {
|
|
261
261
|
try {
|
|
262
262
|
let isTrue = true;
|
|
263
|
-
for await (const [index, item] of this.entries(
|
|
264
|
-
isTrue &&= await
|
|
263
|
+
for await (const [index, item] of this.entries()) {
|
|
264
|
+
isTrue &&= await predicateFn(item, index, this);
|
|
265
265
|
if (!isTrue) {
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
@@ -269,30 +269,29 @@ class AsyncIterableCollection {
|
|
|
269
269
|
return isTrue;
|
|
270
270
|
}
|
|
271
271
|
catch (error) {
|
|
272
|
-
if (error instanceof _module_1.CollectionError
|
|
273
|
-
error instanceof TypeError) {
|
|
272
|
+
if (error instanceof _module_1.CollectionError) {
|
|
274
273
|
throw error;
|
|
275
274
|
}
|
|
276
275
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
277
276
|
}
|
|
278
277
|
}
|
|
279
|
-
take(limit
|
|
280
|
-
return new AsyncIterableCollection(new _module_2.AsyncTakeIterable(this, limit
|
|
278
|
+
take(limit) {
|
|
279
|
+
return new AsyncIterableCollection(new _module_2.AsyncTakeIterable(this, limit));
|
|
281
280
|
}
|
|
282
|
-
takeUntil(
|
|
283
|
-
return new AsyncIterableCollection(new _module_2.AsyncTakeUntilIterable(this,
|
|
281
|
+
takeUntil(predicateFn) {
|
|
282
|
+
return new AsyncIterableCollection(new _module_2.AsyncTakeUntilIterable(this, predicateFn));
|
|
284
283
|
}
|
|
285
|
-
takeWhile(
|
|
286
|
-
return this.takeUntil(async (...arguments_) => !(await
|
|
284
|
+
takeWhile(predicateFn) {
|
|
285
|
+
return this.takeUntil(async (...arguments_) => !(await predicateFn(...arguments_)));
|
|
287
286
|
}
|
|
288
|
-
skip(offset
|
|
289
|
-
return new AsyncIterableCollection(new _module_2.AsyncSkipIterable(this, offset
|
|
287
|
+
skip(offset) {
|
|
288
|
+
return new AsyncIterableCollection(new _module_2.AsyncSkipIterable(this, offset));
|
|
290
289
|
}
|
|
291
|
-
skipUntil(
|
|
292
|
-
return new AsyncIterableCollection(new _module_2.AsyncSkipUntilIterable(this,
|
|
290
|
+
skipUntil(predicateFn) {
|
|
291
|
+
return new AsyncIterableCollection(new _module_2.AsyncSkipUntilIterable(this, predicateFn));
|
|
293
292
|
}
|
|
294
|
-
skipWhile(
|
|
295
|
-
return this.skipUntil(async (...arguments_) => !(await
|
|
293
|
+
skipWhile(predicateFn) {
|
|
294
|
+
return this.skipUntil(async (...arguments_) => !(await predicateFn(...arguments_)));
|
|
296
295
|
}
|
|
297
296
|
when(condition, callback) {
|
|
298
297
|
return new AsyncIterableCollection(new _module_2.AsyncWhenIterable(this, () => condition, callback));
|
|
@@ -311,8 +310,7 @@ class AsyncIterableCollection {
|
|
|
311
310
|
return await callback(this);
|
|
312
311
|
}
|
|
313
312
|
catch (error) {
|
|
314
|
-
if (error instanceof _module_1.CollectionError
|
|
315
|
-
error instanceof TypeError) {
|
|
313
|
+
if (error instanceof _module_1.CollectionError) {
|
|
316
314
|
throw error;
|
|
317
315
|
}
|
|
318
316
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
@@ -324,30 +322,26 @@ class AsyncIterableCollection {
|
|
|
324
322
|
chunk(chunkSize) {
|
|
325
323
|
return new AsyncIterableCollection(new _module_2.AsyncChunkIterable(this, chunkSize, AsyncIterableCollection.makeCollection));
|
|
326
324
|
}
|
|
327
|
-
chunkWhile(
|
|
328
|
-
return new AsyncIterableCollection(new _module_2.AsyncChunkWhileIterable(this,
|
|
325
|
+
chunkWhile(predicateFn) {
|
|
326
|
+
return new AsyncIterableCollection(new _module_2.AsyncChunkWhileIterable(this, predicateFn, AsyncIterableCollection.makeCollection));
|
|
329
327
|
}
|
|
330
|
-
split(chunkAmount
|
|
331
|
-
return new AsyncIterableCollection(new _module_2.AsyncSplitIterable(this, chunkAmount,
|
|
328
|
+
split(chunkAmount) {
|
|
329
|
+
return new AsyncIterableCollection(new _module_2.AsyncSplitIterable(this, chunkAmount, AsyncIterableCollection.makeCollection));
|
|
332
330
|
}
|
|
333
|
-
partition(
|
|
334
|
-
return new AsyncIterableCollection(new _module_2.AsyncPartionIterable(this,
|
|
331
|
+
partition(predicateFn) {
|
|
332
|
+
return new AsyncIterableCollection(new _module_2.AsyncPartionIterable(this, predicateFn, AsyncIterableCollection.makeCollection));
|
|
335
333
|
}
|
|
336
|
-
sliding(
|
|
337
|
-
|
|
338
|
-
return new AsyncIterableCollection(new _module_2.AsyncSlidingIteralbe(this, chunkSize, step, throwOnIndexOverflow));
|
|
334
|
+
sliding(chunkSize, step = chunkSize - 1) {
|
|
335
|
+
return new AsyncIterableCollection(new _module_2.AsyncSlidingIteralbe(this, chunkSize, step));
|
|
339
336
|
}
|
|
340
|
-
groupBy(
|
|
341
|
-
return new AsyncIterableCollection(new _module_2.AsyncGroupByIterable(this,
|
|
342
|
-
AsyncIterableCollection.THROW_ON_NUMBER_LIMIT, AsyncIterableCollection.makeCollection));
|
|
337
|
+
groupBy(selectFn) {
|
|
338
|
+
return new AsyncIterableCollection(new _module_2.AsyncGroupByIterable(this, selectFn, AsyncIterableCollection.makeCollection));
|
|
343
339
|
}
|
|
344
|
-
countBy(
|
|
345
|
-
return new AsyncIterableCollection(new _module_2.AsyncCountByIterable(this,
|
|
346
|
-
AsyncIterableCollection.THROW_ON_NUMBER_LIMIT));
|
|
340
|
+
countBy(selectFn) {
|
|
341
|
+
return new AsyncIterableCollection(new _module_2.AsyncCountByIterable(this, selectFn));
|
|
347
342
|
}
|
|
348
|
-
unique(
|
|
349
|
-
return new AsyncIterableCollection(new _module_2.AsyncUniqueIterable(this,
|
|
350
|
-
AsyncIterableCollection.THROW_ON_NUMBER_LIMIT));
|
|
343
|
+
unique(selectFn) {
|
|
344
|
+
return new AsyncIterableCollection(new _module_2.AsyncUniqueIterable(this, selectFn));
|
|
351
345
|
}
|
|
352
346
|
difference(iterable, selectFn = (item) => item) {
|
|
353
347
|
const differenceCollection = new AsyncIterableCollection(iterable);
|
|
@@ -367,9 +361,8 @@ class AsyncIterableCollection {
|
|
|
367
361
|
padEnd(maxLength, fillItems) {
|
|
368
362
|
return new AsyncIterableCollection(new _module_2.AsyncPadEndIterable(this, maxLength, fillItems, AsyncIterableCollection.makeCollection));
|
|
369
363
|
}
|
|
370
|
-
slice(
|
|
371
|
-
return new AsyncIterableCollection(new _module_2.AsyncSliceIterable(this,
|
|
372
|
-
AsyncIterableCollection.THROW_ON_NUMBER_LIMIT));
|
|
364
|
+
slice(start, end) {
|
|
365
|
+
return new AsyncIterableCollection(new _module_2.AsyncSliceIterable(this, start, end));
|
|
373
366
|
}
|
|
374
367
|
prepend(iterable) {
|
|
375
368
|
return new AsyncIterableCollection(new _module_2.AsyncMergeIterable(iterable, this));
|
|
@@ -377,14 +370,14 @@ class AsyncIterableCollection {
|
|
|
377
370
|
append(iterable) {
|
|
378
371
|
return new AsyncIterableCollection(new _module_2.AsyncMergeIterable(this, iterable));
|
|
379
372
|
}
|
|
380
|
-
insertBefore(
|
|
381
|
-
return new AsyncIterableCollection(new _module_2.AsyncInsertBeforeIterable(this,
|
|
373
|
+
insertBefore(predicateFn, iterable) {
|
|
374
|
+
return new AsyncIterableCollection(new _module_2.AsyncInsertBeforeIterable(this, predicateFn, iterable));
|
|
382
375
|
}
|
|
383
|
-
insertAfter(
|
|
384
|
-
return new AsyncIterableCollection(new _module_2.AsyncInsertAfterIterable(this,
|
|
376
|
+
insertAfter(predicateFn, iterable) {
|
|
377
|
+
return new AsyncIterableCollection(new _module_2.AsyncInsertAfterIterable(this, predicateFn, iterable));
|
|
385
378
|
}
|
|
386
|
-
crossJoin(
|
|
387
|
-
return new AsyncIterableCollection(new _module_2.AsyncCrossJoinIterable(this,
|
|
379
|
+
crossJoin(iterable) {
|
|
380
|
+
return new AsyncIterableCollection(new _module_2.AsyncCrossJoinIterable(this, iterable, AsyncIterableCollection.makeCollection));
|
|
388
381
|
}
|
|
389
382
|
zip(iterable) {
|
|
390
383
|
return new AsyncIterableCollection(new _module_2.AsyncZipIterable(this, iterable));
|
|
@@ -392,150 +385,111 @@ class AsyncIterableCollection {
|
|
|
392
385
|
sort(comparator) {
|
|
393
386
|
return new AsyncIterableCollection(new _module_2.AsyncSortIterable(this, comparator));
|
|
394
387
|
}
|
|
395
|
-
reverse(
|
|
396
|
-
return new AsyncIterableCollection(new _module_2.AsyncReverseIterable(this,
|
|
397
|
-
AsyncIterableCollection.DEFAULT_CHUNK_SIZE, settings?.throwOnIndexOverflow ??
|
|
398
|
-
AsyncIterableCollection.THROW_ON_NUMBER_LIMIT, AsyncIterableCollection.makeCollection));
|
|
388
|
+
reverse(chunkSize) {
|
|
389
|
+
return new AsyncIterableCollection(new _module_2.AsyncReverseIterable(this, chunkSize ?? AsyncIterableCollection.DEFAULT_CHUNK_SIZE, AsyncIterableCollection.makeCollection));
|
|
399
390
|
}
|
|
400
|
-
shuffle() {
|
|
401
|
-
return new AsyncIterableCollection(new _module_2.AsyncShuffleIterable(this));
|
|
391
|
+
shuffle(mathRandom = Math.random) {
|
|
392
|
+
return new AsyncIterableCollection(new _module_2.AsyncShuffleIterable(this, mathRandom));
|
|
402
393
|
}
|
|
403
|
-
async first(
|
|
404
|
-
return this.firstOr(
|
|
405
|
-
...settings,
|
|
406
|
-
defaultValue: null,
|
|
407
|
-
});
|
|
394
|
+
async first(predicateFn) {
|
|
395
|
+
return this.firstOr(null, predicateFn);
|
|
408
396
|
}
|
|
409
|
-
async firstOr(
|
|
397
|
+
async firstOr(defaultValue, predicateFn = () => true) {
|
|
410
398
|
try {
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
const filter = settings.predicateFn ?? (() => true);
|
|
414
|
-
for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
|
|
415
|
-
if (await filter(item, index, this)) {
|
|
399
|
+
for await (const [index, item] of this.entries()) {
|
|
400
|
+
if (await predicateFn(item, index, this)) {
|
|
416
401
|
return item;
|
|
417
402
|
}
|
|
418
403
|
}
|
|
419
|
-
|
|
420
|
-
const defaultFn = settings.defaultValue;
|
|
421
|
-
return defaultFn();
|
|
422
|
-
}
|
|
423
|
-
return settings.defaultValue;
|
|
404
|
+
return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
|
|
424
405
|
}
|
|
425
406
|
catch (error) {
|
|
426
|
-
if (error instanceof _module_1.CollectionError
|
|
427
|
-
error instanceof TypeError) {
|
|
407
|
+
if (error instanceof _module_1.CollectionError) {
|
|
428
408
|
throw error;
|
|
429
409
|
}
|
|
430
410
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
431
411
|
}
|
|
432
412
|
}
|
|
433
|
-
async firstOrFail(
|
|
434
|
-
const item = await this.first(
|
|
413
|
+
async firstOrFail(predicateFn) {
|
|
414
|
+
const item = await this.first(predicateFn);
|
|
435
415
|
if (item === null) {
|
|
436
|
-
throw new _module_1.
|
|
416
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
437
417
|
}
|
|
438
418
|
return item;
|
|
439
419
|
}
|
|
440
|
-
async last(
|
|
441
|
-
return this.lastOr(
|
|
442
|
-
...settings,
|
|
443
|
-
defaultValue: null,
|
|
444
|
-
});
|
|
420
|
+
async last(predicateFn) {
|
|
421
|
+
return this.lastOr(null, predicateFn);
|
|
445
422
|
}
|
|
446
|
-
async lastOr(
|
|
423
|
+
async lastOr(defaultValue, predicateFn = () => true) {
|
|
447
424
|
try {
|
|
448
|
-
const throwOnIndexOverflow = settings.throwOnIndexOverflow ??
|
|
449
|
-
AsyncIterableCollection.THROW_ON_NUMBER_LIMIT;
|
|
450
|
-
const filter = settings.predicateFn ?? (() => true);
|
|
451
425
|
let matchedItem = null;
|
|
452
|
-
for await (const [index, item] of this.entries(
|
|
453
|
-
if (await
|
|
426
|
+
for await (const [index, item] of this.entries()) {
|
|
427
|
+
if (await predicateFn(item, index, this)) {
|
|
454
428
|
matchedItem = item;
|
|
455
429
|
}
|
|
456
430
|
}
|
|
457
431
|
if (matchedItem) {
|
|
458
432
|
return matchedItem;
|
|
459
433
|
}
|
|
460
|
-
|
|
461
|
-
const defaultFn = settings.defaultValue;
|
|
462
|
-
return defaultFn();
|
|
463
|
-
}
|
|
464
|
-
return settings.defaultValue;
|
|
434
|
+
return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
|
|
465
435
|
}
|
|
466
436
|
catch (error) {
|
|
467
|
-
if (error instanceof _module_1.CollectionError
|
|
468
|
-
error instanceof TypeError) {
|
|
437
|
+
if (error instanceof _module_1.CollectionError) {
|
|
469
438
|
throw error;
|
|
470
439
|
}
|
|
471
440
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
472
441
|
}
|
|
473
442
|
}
|
|
474
|
-
async lastOrFail(
|
|
475
|
-
const item = await this.last(
|
|
443
|
+
async lastOrFail(predicateFn) {
|
|
444
|
+
const item = await this.last(predicateFn);
|
|
476
445
|
if (item === null) {
|
|
477
|
-
throw new _module_1.
|
|
446
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
478
447
|
}
|
|
479
448
|
return item;
|
|
480
449
|
}
|
|
481
|
-
async before(
|
|
482
|
-
return this.beforeOr(null,
|
|
450
|
+
async before(predicateFn) {
|
|
451
|
+
return this.beforeOr(null, predicateFn);
|
|
483
452
|
}
|
|
484
|
-
async beforeOr(defaultValue,
|
|
453
|
+
async beforeOr(defaultValue, predicateFn) {
|
|
485
454
|
try {
|
|
486
455
|
let beforeItem = null, index = 0;
|
|
487
456
|
for await (const item of this) {
|
|
488
|
-
if (
|
|
489
|
-
throw new _module_1.IndexOverflowError("Index has overflowed");
|
|
490
|
-
}
|
|
491
|
-
if ((await filter(item, index, this)) && beforeItem) {
|
|
457
|
+
if ((await predicateFn(item, index, this)) && beforeItem) {
|
|
492
458
|
return beforeItem;
|
|
493
459
|
}
|
|
494
460
|
index++;
|
|
495
461
|
beforeItem = item;
|
|
496
462
|
}
|
|
497
|
-
|
|
498
|
-
const defaultFn = defaultValue;
|
|
499
|
-
return defaultFn();
|
|
500
|
-
}
|
|
501
|
-
return defaultValue;
|
|
463
|
+
return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
|
|
502
464
|
}
|
|
503
465
|
catch (error) {
|
|
504
|
-
if (error instanceof _module_1.CollectionError
|
|
505
|
-
error instanceof TypeError) {
|
|
466
|
+
if (error instanceof _module_1.CollectionError) {
|
|
506
467
|
throw error;
|
|
507
468
|
}
|
|
508
469
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
509
470
|
}
|
|
510
471
|
}
|
|
511
|
-
async beforeOrFail(
|
|
512
|
-
const item = await this.before(
|
|
472
|
+
async beforeOrFail(predicateFn) {
|
|
473
|
+
const item = await this.before(predicateFn);
|
|
513
474
|
if (item === null) {
|
|
514
|
-
throw new _module_1.
|
|
475
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
515
476
|
}
|
|
516
477
|
return item;
|
|
517
478
|
}
|
|
518
|
-
async after(
|
|
519
|
-
return this.afterOr(null,
|
|
479
|
+
async after(predicateFn) {
|
|
480
|
+
return this.afterOr(null, predicateFn);
|
|
520
481
|
}
|
|
521
|
-
async afterOr(defaultValue,
|
|
482
|
+
async afterOr(defaultValue, predicateFn) {
|
|
522
483
|
try {
|
|
523
484
|
let hasMatched = false, index = 0;
|
|
524
485
|
for await (const item of this) {
|
|
525
486
|
if (hasMatched) {
|
|
526
487
|
return item;
|
|
527
488
|
}
|
|
528
|
-
|
|
529
|
-
throw new _module_1.IndexOverflowError("Index has overflowed");
|
|
530
|
-
}
|
|
531
|
-
hasMatched = await filter(item, index, this);
|
|
489
|
+
hasMatched = await predicateFn(item, index, this);
|
|
532
490
|
index++;
|
|
533
491
|
}
|
|
534
|
-
|
|
535
|
-
const defaultFn = defaultValue;
|
|
536
|
-
return defaultFn();
|
|
537
|
-
}
|
|
538
|
-
return defaultValue;
|
|
492
|
+
return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
|
|
539
493
|
}
|
|
540
494
|
catch (error) {
|
|
541
495
|
if (error instanceof _module_1.CollectionError) {
|
|
@@ -544,32 +498,31 @@ class AsyncIterableCollection {
|
|
|
544
498
|
throw new _module_1.UnexpectedCollectionError("!!__messge__!!", error);
|
|
545
499
|
}
|
|
546
500
|
}
|
|
547
|
-
async afterOrFail(
|
|
548
|
-
const item = await this.after(
|
|
501
|
+
async afterOrFail(predicateFn) {
|
|
502
|
+
const item = await this.after(predicateFn);
|
|
549
503
|
if (item === null) {
|
|
550
|
-
throw new _module_1.
|
|
504
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
551
505
|
}
|
|
552
506
|
return item;
|
|
553
507
|
}
|
|
554
|
-
async sole(
|
|
508
|
+
async sole(predicateFn) {
|
|
555
509
|
try {
|
|
556
510
|
let matchedItem = null;
|
|
557
|
-
for await (const [index, item] of this.entries(
|
|
558
|
-
if (await
|
|
511
|
+
for await (const [index, item] of this.entries()) {
|
|
512
|
+
if (await predicateFn(item, index, this)) {
|
|
559
513
|
if (matchedItem !== null) {
|
|
560
|
-
throw new _module_1.
|
|
514
|
+
throw new _module_1.MultipleItemsFoundCollectionError("Multiple items were found");
|
|
561
515
|
}
|
|
562
516
|
matchedItem = item;
|
|
563
517
|
}
|
|
564
518
|
}
|
|
565
519
|
if (matchedItem === null) {
|
|
566
|
-
throw new _module_1.
|
|
520
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
567
521
|
}
|
|
568
522
|
return matchedItem;
|
|
569
523
|
}
|
|
570
524
|
catch (error) {
|
|
571
|
-
if (error instanceof _module_1.CollectionError
|
|
572
|
-
error instanceof TypeError) {
|
|
525
|
+
if (error instanceof _module_1.CollectionError) {
|
|
573
526
|
throw error;
|
|
574
527
|
}
|
|
575
528
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
@@ -587,29 +540,25 @@ class AsyncIterableCollection {
|
|
|
587
540
|
timeout(timeInMs) {
|
|
588
541
|
return new AsyncIterableCollection(new _module_2.AsyncTimeoutIterable(this, timeInMs));
|
|
589
542
|
}
|
|
590
|
-
async count(
|
|
543
|
+
async count(predicateFn) {
|
|
591
544
|
try {
|
|
592
545
|
let size = 0;
|
|
593
546
|
for await (const item of this) {
|
|
594
|
-
if (
|
|
595
|
-
throw new _module_1.IndexOverflowError("Size has overflowed");
|
|
596
|
-
}
|
|
597
|
-
if (await filter(item, size, this)) {
|
|
547
|
+
if (await predicateFn(item, size, this)) {
|
|
598
548
|
size++;
|
|
599
549
|
}
|
|
600
550
|
}
|
|
601
551
|
return size;
|
|
602
552
|
}
|
|
603
553
|
catch (error) {
|
|
604
|
-
if (error instanceof _module_1.CollectionError
|
|
605
|
-
error instanceof TypeError) {
|
|
554
|
+
if (error instanceof _module_1.CollectionError) {
|
|
606
555
|
throw error;
|
|
607
556
|
}
|
|
608
557
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
609
558
|
}
|
|
610
559
|
}
|
|
611
|
-
async size(
|
|
612
|
-
return this.count(() => true
|
|
560
|
+
async size() {
|
|
561
|
+
return this.count(() => true);
|
|
613
562
|
}
|
|
614
563
|
async isEmpty() {
|
|
615
564
|
try {
|
|
@@ -619,8 +568,7 @@ class AsyncIterableCollection {
|
|
|
619
568
|
return true;
|
|
620
569
|
}
|
|
621
570
|
catch (error) {
|
|
622
|
-
if (error instanceof _module_1.CollectionError
|
|
623
|
-
error instanceof TypeError) {
|
|
571
|
+
if (error instanceof _module_1.CollectionError) {
|
|
624
572
|
throw error;
|
|
625
573
|
}
|
|
626
574
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
@@ -629,43 +577,41 @@ class AsyncIterableCollection {
|
|
|
629
577
|
async isNotEmpty() {
|
|
630
578
|
return !(await this.isEmpty());
|
|
631
579
|
}
|
|
632
|
-
async searchFirst(
|
|
580
|
+
async searchFirst(predicateFn) {
|
|
633
581
|
try {
|
|
634
|
-
for await (const [index, item] of this.entries(
|
|
635
|
-
if (await
|
|
582
|
+
for await (const [index, item] of this.entries()) {
|
|
583
|
+
if (await predicateFn(item, index, this)) {
|
|
636
584
|
return index;
|
|
637
585
|
}
|
|
638
586
|
}
|
|
639
587
|
return -1;
|
|
640
588
|
}
|
|
641
589
|
catch (error) {
|
|
642
|
-
if (error instanceof _module_1.CollectionError
|
|
643
|
-
error instanceof TypeError) {
|
|
590
|
+
if (error instanceof _module_1.CollectionError) {
|
|
644
591
|
throw error;
|
|
645
592
|
}
|
|
646
593
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
647
594
|
}
|
|
648
595
|
}
|
|
649
|
-
async searchLast(
|
|
596
|
+
async searchLast(predicateFn) {
|
|
650
597
|
try {
|
|
651
598
|
let matchedIndex = -1;
|
|
652
|
-
for await (const [index, item] of this.entries(
|
|
653
|
-
if (await
|
|
599
|
+
for await (const [index, item] of this.entries()) {
|
|
600
|
+
if (await predicateFn(item, index, this)) {
|
|
654
601
|
matchedIndex = index;
|
|
655
602
|
}
|
|
656
603
|
}
|
|
657
604
|
return matchedIndex;
|
|
658
605
|
}
|
|
659
606
|
catch (error) {
|
|
660
|
-
if (error instanceof _module_1.CollectionError
|
|
661
|
-
error instanceof TypeError) {
|
|
607
|
+
if (error instanceof _module_1.CollectionError) {
|
|
662
608
|
throw error;
|
|
663
609
|
}
|
|
664
610
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
665
611
|
}
|
|
666
612
|
}
|
|
667
|
-
async forEach(callback
|
|
668
|
-
for await (const [index, item] of this.entries(
|
|
613
|
+
async forEach(callback) {
|
|
614
|
+
for await (const [index, item] of this.entries()) {
|
|
669
615
|
await callback(item, index, this);
|
|
670
616
|
}
|
|
671
617
|
}
|
|
@@ -678,8 +624,7 @@ class AsyncIterableCollection {
|
|
|
678
624
|
return items;
|
|
679
625
|
}
|
|
680
626
|
catch (error) {
|
|
681
|
-
if (error instanceof _module_1.CollectionError
|
|
682
|
-
error instanceof TypeError) {
|
|
627
|
+
if (error instanceof _module_1.CollectionError) {
|
|
683
628
|
throw error;
|
|
684
629
|
}
|
|
685
630
|
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|