@daiso-tech/core 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_module.js +2 -0
- package/dist/cjs/_module.js.map +1 -1
- package/dist/cjs/async/_module.js +30 -0
- package/dist/cjs/async/_module.js.map +1 -0
- package/dist/cjs/async/_shared.js +34 -0
- package/dist/cjs/async/_shared.js.map +1 -0
- package/dist/cjs/async/abortable/_module.js +18 -0
- package/dist/cjs/async/abortable/_module.js.map +1 -0
- package/dist/cjs/async/abortable/abortable.js +48 -0
- package/dist/cjs/async/abortable/abortable.js.map +1 -0
- package/dist/cjs/async/abortable-iterable/_module.js +18 -0
- package/dist/cjs/async/abortable-iterable/_module.js.map +1 -0
- package/dist/cjs/async/abortable-iterable/abortable-iterable.js +32 -0
- package/dist/cjs/async/abortable-iterable/abortable-iterable.js.map +1 -0
- package/dist/cjs/async/backof-policies/_module.js +21 -0
- package/dist/cjs/async/backof-policies/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/_shared.js +7 -0
- package/dist/cjs/async/backof-policies/_shared.js.map +1 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +19 -0
- package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +23 -0
- package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +23 -0
- package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js +18 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +23 -0
- package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/cjs/async/delay/_module.js +18 -0
- package/dist/cjs/async/delay/_module.js.map +1 -0
- package/dist/cjs/async/delay/delay.js +24 -0
- package/dist/cjs/async/delay/delay.js.map +1 -0
- package/dist/cjs/async/delay-iterable/_module.js +18 -0
- package/dist/cjs/async/delay-iterable/_module.js.map +1 -0
- package/dist/cjs/async/delay-iterable/delay-iterable.js +36 -0
- package/dist/cjs/async/delay-iterable/delay-iterable.js.map +1 -0
- package/dist/cjs/async/lazy-promise/_module.js +18 -0
- package/dist/cjs/async/lazy-promise/_module.js.map +1 -0
- package/dist/cjs/async/lazy-promise/lazy-promise.js +22 -0
- package/dist/cjs/async/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/cjs/async/retry/_module.js +18 -0
- package/dist/cjs/async/retry/_module.js.map +1 -0
- package/dist/cjs/async/retry/retry.js +43 -0
- package/dist/cjs/async/retry/retry.js.map +1 -0
- package/dist/cjs/async/retry-iterable/_module.js +18 -0
- package/dist/cjs/async/retry-iterable/_module.js.map +1 -0
- package/dist/cjs/async/retry-iterable/retry-iterable.js +32 -0
- package/dist/cjs/async/retry-iterable/retry-iterable.js.map +1 -0
- package/dist/cjs/async/timeout/_module.js +18 -0
- package/dist/cjs/async/timeout/_module.js.map +1 -0
- package/dist/cjs/async/timeout/timeout.js +28 -0
- package/dist/cjs/async/timeout/timeout.js.map +1 -0
- package/dist/cjs/async/timeout-iterable/_module.js +18 -0
- package/dist/cjs/async/timeout-iterable/_module.js.map +1 -0
- package/dist/cjs/async/timeout-iterable/timeout-iterable.js +11 -0
- package/dist/cjs/async/timeout-iterable/timeout-iterable.js.map +1 -0
- package/dist/cjs/collection/async-iterable-collection/_shared/_module.js +1 -3
- 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 +14 -23
- 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-while-iterable.js +12 -21
- package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-collapse-iterable.js +5 -14
- 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 +9 -18
- 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 +18 -27
- 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-error-handler-iterable.js +31 -0
- package/dist/cjs/collection/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -0
- package/dist/cjs/collection/async-iterable-collection/_shared/async-filter-iterable.js +3 -12
- 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 +2 -11
- 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-insert-after-iterable.js +8 -17
- 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 +8 -17
- 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 +2 -11
- 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 +2 -11
- package/dist/cjs/collection/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-partion-iterable.js +9 -18
- 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 +4 -13
- package/dist/cjs/collection/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-iterable.js +3 -12
- 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 +7 -16
- 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-sliding-iterable.js +9 -18
- 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 +17 -26
- 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 +3 -12
- 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 +4 -13
- 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 +2 -11
- 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 +6 -15
- 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 +5 -14
- 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 +4 -13
- package/dist/cjs/collection/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js +177 -265
- package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/chunk-iterable.js +14 -23
- package/dist/cjs/collection/iterable-collection/_shared/chunk-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/chunk-while-iterable.js +12 -21
- package/dist/cjs/collection/iterable-collection/_shared/chunk-while-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/collapse-iterable.js +5 -14
- package/dist/cjs/collection/iterable-collection/_shared/collapse-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/count-by-iterable.js +9 -18
- 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 +19 -31
- package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/entries-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/entries-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/filter-iterable.js +3 -12
- package/dist/cjs/collection/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/flat-map-iterable.js +2 -11
- 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 +9 -18
- 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 +6 -16
- 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 +6 -16
- package/dist/cjs/collection/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/map-iterable.js +2 -11
- package/dist/cjs/collection/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/merge-iterable.js +2 -11
- package/dist/cjs/collection/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/pad-end-iterable.js +11 -20
- 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 +11 -20
- 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 -18
- package/dist/cjs/collection/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/repeat-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/repeat-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/reverse-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/reverse-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/shuffle-iterable.js +9 -18
- package/dist/cjs/collection/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/skip-iterable.js +3 -12
- package/dist/cjs/collection/iterable-collection/_shared/skip-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/skip-until-iterable.js +6 -15
- package/dist/cjs/collection/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/slice-iterable.js +15 -24
- package/dist/cjs/collection/iterable-collection/_shared/slice-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/sliding-iterable.js +9 -18
- package/dist/cjs/collection/iterable-collection/_shared/sliding-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/sort-iterable.js +1 -10
- package/dist/cjs/collection/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/split-iterable.js +17 -26
- package/dist/cjs/collection/iterable-collection/_shared/split-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/take-iterable.js +3 -12
- package/dist/cjs/collection/iterable-collection/_shared/take-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/take-until-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/tap-iterable.js +2 -11
- package/dist/cjs/collection/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/unique-iterable.js +6 -15
- package/dist/cjs/collection/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/update-iterable.js +5 -14
- package/dist/cjs/collection/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/when-iterable.js +4 -13
- package/dist/cjs/collection/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/_shared/zip-iterable.js +6 -15
- package/dist/cjs/collection/iterable-collection/_shared/zip-iterable.js.map +1 -1
- package/dist/cjs/collection/iterable-collection/iterable-collection.js +154 -346
- package/dist/cjs/collection/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/cjs/collection/list-collection/list-collection.js +348 -931
- package/dist/cjs/collection/list-collection/list-collection.js.map +1 -1
- package/dist/cjs/storage/storage.js +25 -15
- package/dist/cjs/storage/storage.js.map +1 -1
- package/dist/cjs/utilities/_module.js +18 -0
- package/dist/cjs/utilities/_module.js.map +1 -0
- package/dist/cjs/utilities/time-span/_module.js +18 -0
- package/dist/cjs/utilities/time-span/_module.js.map +1 -0
- package/dist/cjs/utilities/time-span/time-span.js +103 -0
- package/dist/cjs/utilities/time-span/time-span.js.map +1 -0
- package/dist/esm/_module.js +2 -0
- package/dist/esm/_module.js.map +1 -1
- package/dist/esm/async/_module.js +12 -0
- package/dist/esm/async/_module.js.map +1 -0
- package/dist/esm/async/_shared.js +27 -0
- package/dist/esm/async/_shared.js.map +1 -0
- package/dist/esm/async/abortable/_module.js +2 -0
- package/dist/esm/async/abortable/_module.js.map +1 -0
- package/dist/esm/async/abortable/abortable.js +45 -0
- package/dist/esm/async/abortable/abortable.js.map +1 -0
- package/dist/esm/async/abortable-iterable/_module.js +2 -0
- package/dist/esm/async/abortable-iterable/_module.js.map +1 -0
- package/dist/esm/async/abortable-iterable/abortable-iterable.js +29 -0
- package/dist/esm/async/abortable-iterable/abortable-iterable.js.map +1 -0
- package/dist/esm/async/backof-policies/_module.js +5 -0
- package/dist/esm/async/backof-policies/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/_shared.js +4 -0
- package/dist/esm/async/backof-policies/_shared.js.map +1 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +16 -0
- package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +20 -0
- package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +20 -0
- package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js +2 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +20 -0
- package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
- package/dist/esm/async/delay/_module.js +2 -0
- package/dist/esm/async/delay/_module.js.map +1 -0
- package/dist/esm/async/delay/delay.js +21 -0
- package/dist/esm/async/delay/delay.js.map +1 -0
- package/dist/esm/async/delay-iterable/_module.js +2 -0
- package/dist/esm/async/delay-iterable/_module.js.map +1 -0
- package/dist/esm/async/delay-iterable/delay-iterable.js +33 -0
- package/dist/esm/async/delay-iterable/delay-iterable.js.map +1 -0
- package/dist/esm/async/lazy-promise/_module.js +2 -0
- package/dist/esm/async/lazy-promise/_module.js.map +1 -0
- package/dist/esm/async/lazy-promise/lazy-promise.js +17 -0
- package/dist/esm/async/lazy-promise/lazy-promise.js.map +1 -0
- package/dist/esm/async/retry/_module.js +2 -0
- package/dist/esm/async/retry/_module.js.map +1 -0
- package/dist/esm/async/retry/retry.js +40 -0
- package/dist/esm/async/retry/retry.js.map +1 -0
- package/dist/esm/async/retry-iterable/_module.js +2 -0
- package/dist/esm/async/retry-iterable/_module.js.map +1 -0
- package/dist/esm/async/retry-iterable/retry-iterable.js +29 -0
- package/dist/esm/async/retry-iterable/retry-iterable.js.map +1 -0
- package/dist/esm/async/timeout/_module.js +2 -0
- package/dist/esm/async/timeout/_module.js.map +1 -0
- package/dist/esm/async/timeout/timeout.js +25 -0
- package/dist/esm/async/timeout/timeout.js.map +1 -0
- package/dist/esm/async/timeout-iterable/_module.js +2 -0
- package/dist/esm/async/timeout-iterable/_module.js.map +1 -0
- package/dist/esm/async/timeout-iterable/timeout-iterable.js +8 -0
- package/dist/esm/async/timeout-iterable/timeout-iterable.js.map +1 -0
- package/dist/esm/collection/async-iterable-collection/_shared/_module.js +1 -3
- 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 +14 -23
- 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 +12 -21
- package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-collapse-iterable.js +5 -14
- 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 +9 -18
- 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 +17 -26
- 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-error-handler-iterable.js +27 -0
- package/dist/esm/collection/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -0
- package/dist/esm/collection/async-iterable-collection/_shared/async-filter-iterable.js +3 -12
- 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 +2 -11
- 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-insert-after-iterable.js +8 -17
- 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 +8 -17
- 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 +2 -11
- 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 +2 -11
- package/dist/esm/collection/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-partion-iterable.js +9 -18
- 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 +4 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-skip-iterable.js +3 -12
- 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 +7 -16
- 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-sliding-iterable.js +9 -18
- 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 +17 -26
- 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 +3 -12
- 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 +4 -13
- 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 +2 -11
- 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 +6 -15
- 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 +5 -14
- 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 +4 -13
- package/dist/esm/collection/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js +179 -267
- package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/chunk-iterable.js +14 -23
- package/dist/esm/collection/iterable-collection/_shared/chunk-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/chunk-while-iterable.js +12 -21
- package/dist/esm/collection/iterable-collection/_shared/chunk-while-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/collapse-iterable.js +5 -14
- package/dist/esm/collection/iterable-collection/_shared/collapse-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/count-by-iterable.js +9 -18
- 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 +19 -31
- package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/entries-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/entries-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/filter-iterable.js +3 -12
- package/dist/esm/collection/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/flat-map-iterable.js +2 -11
- 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 +9 -18
- 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 +6 -16
- 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 +6 -16
- package/dist/esm/collection/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/map-iterable.js +2 -11
- package/dist/esm/collection/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/merge-iterable.js +2 -11
- package/dist/esm/collection/iterable-collection/_shared/merge-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/pad-end-iterable.js +11 -20
- 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 +11 -20
- 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 -18
- package/dist/esm/collection/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/repeat-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/repeat-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/reverse-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/reverse-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/shuffle-iterable.js +9 -18
- package/dist/esm/collection/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/skip-iterable.js +3 -12
- package/dist/esm/collection/iterable-collection/_shared/skip-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/skip-until-iterable.js +6 -15
- package/dist/esm/collection/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/slice-iterable.js +15 -24
- package/dist/esm/collection/iterable-collection/_shared/slice-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/sliding-iterable.js +9 -18
- package/dist/esm/collection/iterable-collection/_shared/sliding-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/sort-iterable.js +1 -10
- package/dist/esm/collection/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/split-iterable.js +17 -26
- package/dist/esm/collection/iterable-collection/_shared/split-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/take-iterable.js +3 -12
- package/dist/esm/collection/iterable-collection/_shared/take-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/take-until-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/tap-iterable.js +2 -11
- package/dist/esm/collection/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/unique-iterable.js +6 -15
- package/dist/esm/collection/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/update-iterable.js +5 -14
- package/dist/esm/collection/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/when-iterable.js +4 -13
- package/dist/esm/collection/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/_shared/zip-iterable.js +6 -15
- package/dist/esm/collection/iterable-collection/_shared/zip-iterable.js.map +1 -1
- package/dist/esm/collection/iterable-collection/iterable-collection.js +155 -347
- package/dist/esm/collection/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/esm/collection/list-collection/list-collection.js +349 -932
- package/dist/esm/collection/list-collection/list-collection.js.map +1 -1
- package/dist/esm/storage/storage.js +25 -15
- package/dist/esm/storage/storage.js.map +1 -1
- package/dist/esm/utilities/_module.js +2 -0
- package/dist/esm/utilities/_module.js.map +1 -0
- package/dist/esm/utilities/time-span/_module.js +2 -0
- package/dist/esm/utilities/time-span/_module.js.map +1 -0
- package/dist/esm/utilities/time-span/time-span.js +99 -0
- package/dist/esm/utilities/time-span/time-span.js.map +1 -0
- package/dist/types/_module.d.ts +2 -0
- package/dist/types/_shared/types.d.ts +2 -2
- package/dist/types/async/_module.d.ts +11 -0
- package/dist/types/async/_shared.d.ts +35 -0
- package/dist/types/async/abortable/_module.d.ts +1 -0
- package/dist/types/async/abortable/abortable.d.ts +39 -0
- package/dist/types/async/abortable-iterable/_module.d.ts +1 -0
- package/dist/types/async/abortable-iterable/abortable-iterable.d.ts +36 -0
- package/dist/types/async/backof-policies/_module.d.ts +5 -0
- package/dist/types/async/backof-policies/_shared.d.ts +12 -0
- package/dist/types/async/backof-policies/constant-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +28 -0
- package/dist/types/async/backof-policies/exponential-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +36 -0
- package/dist/types/async/backof-policies/linear-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +32 -0
- package/dist/types/async/backof-policies/polynomial-backoff-policy/_module.d.ts +1 -0
- package/dist/types/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +36 -0
- package/dist/types/async/delay/_module.d.ts +1 -0
- package/dist/types/async/delay/delay.d.ts +38 -0
- package/dist/types/async/delay-iterable/_module.d.ts +1 -0
- package/dist/types/async/delay-iterable/delay-iterable.d.ts +57 -0
- package/dist/types/async/lazy-promise/_module.d.ts +1 -0
- package/dist/types/async/lazy-promise/lazy-promise.d.ts +28 -0
- package/dist/types/async/retry/_module.d.ts +1 -0
- package/dist/types/async/retry/retry.d.ts +86 -0
- package/dist/types/async/retry-iterable/_module.d.ts +1 -0
- package/dist/types/async/retry-iterable/retry-iterable.d.ts +86 -0
- package/dist/types/async/timeout/_module.d.ts +1 -0
- package/dist/types/async/timeout/timeout.d.ts +40 -0
- package/dist/types/async/timeout-iterable/_module.d.ts +1 -0
- package/dist/types/async/timeout-iterable/timeout-iterable.d.ts +64 -0
- package/dist/types/collection/async-iterable-collection/_shared/_module.d.ts +1 -3
- package/dist/types/collection/async-iterable-collection/_shared/async-error-handler-iterable.d.ts +6 -0
- package/dist/types/collection/async-iterable-collection/_shared/async-when-iterable.d.ts +1 -1
- package/dist/types/collection/async-iterable-collection/async-iterable-collection.d.ts +39 -37
- package/dist/types/contracts/collection/_shared.d.ts +7 -7
- package/dist/types/contracts/collection/async-collection.contract.d.ts +51 -39
- package/dist/types/contracts/storage/storage.contract.d.ts +2 -1
- package/dist/types/storage/storage.d.ts +5 -3
- package/dist/types/utilities/_module.d.ts +1 -0
- package/dist/types/utilities/time-span/_module.d.ts +1 -0
- package/dist/types/utilities/time-span/time-span.d.ts +50 -0
- package/package.json +1 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-abort-iterable.js +0 -25
- package/dist/cjs/collection/async-iterable-collection/_shared/async-abort-iterable.js.map +0 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-delay-iterable.js +0 -25
- package/dist/cjs/collection/async-iterable-collection/_shared/async-delay-iterable.js.map +0 -1
- package/dist/cjs/collection/async-iterable-collection/_shared/async-timeout-iterable.js +0 -21
- package/dist/cjs/collection/async-iterable-collection/_shared/async-timeout-iterable.js.map +0 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-abort-iterable.js +0 -21
- package/dist/esm/collection/async-iterable-collection/_shared/async-abort-iterable.js.map +0 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-delay-iterable.js +0 -21
- package/dist/esm/collection/async-iterable-collection/_shared/async-delay-iterable.js.map +0 -1
- package/dist/esm/collection/async-iterable-collection/_shared/async-timeout-iterable.js +0 -17
- package/dist/esm/collection/async-iterable-collection/_shared/async-timeout-iterable.js.map +0 -1
- package/dist/types/collection/async-iterable-collection/_shared/async-abort-iterable.d.ts +0 -10
- package/dist/types/collection/async-iterable-collection/_shared/async-delay-iterable.d.ts +0 -10
- package/dist/types/collection/async-iterable-collection/_shared/async-timeout-iterable.d.ts +0 -10
|
@@ -4,6 +4,8 @@ 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
6
|
const utilities_1 = require("../../_shared/utilities");
|
|
7
|
+
const _module_3 = require("../../_module");
|
|
8
|
+
const _module_4 = require("../../async/_module");
|
|
7
9
|
class AsyncIterableCollection {
|
|
8
10
|
iterable;
|
|
9
11
|
static DEFAULT_CHUNK_SIZE = 1024;
|
|
@@ -37,41 +39,45 @@ class AsyncIterableCollection {
|
|
|
37
39
|
map(mapFn) {
|
|
38
40
|
return new AsyncIterableCollection(new _module_2.AsyncMapIterable(this, mapFn));
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (initialValue !== undefined) {
|
|
45
|
-
let output = initialValue;
|
|
46
|
-
for await (const [index, item] of this.entries()) {
|
|
47
|
-
output = await reduceFn(output, item, index, this);
|
|
48
|
-
}
|
|
49
|
-
return output;
|
|
50
|
-
}
|
|
51
|
-
let output = (await this.firstOrFail()), index = 0, isFirstIteration = true;
|
|
52
|
-
for await (const item of this) {
|
|
53
|
-
if (!isFirstIteration) {
|
|
54
|
-
output = await reduceFn(output, item, index, this);
|
|
42
|
+
reduce(reduceFn, initialValue) {
|
|
43
|
+
return new _module_3.LazyPromise(async () => {
|
|
44
|
+
if (initialValue === undefined && (await this.isEmpty())) {
|
|
45
|
+
throw new _module_1.TypeCollectionError("Reduce of empty array must be inputed a initial value");
|
|
55
46
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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");
|
|
47
|
+
if (initialValue !== undefined) {
|
|
48
|
+
let output = initialValue;
|
|
49
|
+
for await (const [index, item] of this.entries()) {
|
|
50
|
+
output = await reduceFn(output, item, index, this);
|
|
51
|
+
}
|
|
52
|
+
return output;
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
let output = (await this.firstOrFail()), index = 0, isFirstIteration = true;
|
|
55
|
+
for await (const item of this) {
|
|
56
|
+
if (!isFirstIteration) {
|
|
57
|
+
output = await reduceFn(output, item, index, this);
|
|
58
|
+
}
|
|
59
|
+
isFirstIteration = false;
|
|
60
|
+
index++;
|
|
69
61
|
}
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
return output;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
join(separator = ",") {
|
|
66
|
+
return new _module_3.LazyPromise(async () => {
|
|
67
|
+
let str = null;
|
|
68
|
+
for await (const item of this) {
|
|
69
|
+
if (typeof item !== "string") {
|
|
70
|
+
throw new _module_1.TypeCollectionError("Item type is invalid must be string");
|
|
71
|
+
}
|
|
72
|
+
if (str === null) {
|
|
73
|
+
str = item;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
str = str + separator + item;
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
return str;
|
|
80
|
+
});
|
|
75
81
|
}
|
|
76
82
|
collapse() {
|
|
77
83
|
return new AsyncIterableCollection(new _module_2.AsyncCollapseIterable(this));
|
|
@@ -88,8 +94,8 @@ class AsyncIterableCollection {
|
|
|
88
94
|
}
|
|
89
95
|
return this.skip((page - 1) * pageSize).take(pageSize);
|
|
90
96
|
}
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
sum() {
|
|
98
|
+
return new _module_3.LazyPromise(async () => {
|
|
93
99
|
if (await this.isEmpty()) {
|
|
94
100
|
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
95
101
|
}
|
|
@@ -101,16 +107,10 @@ class AsyncIterableCollection {
|
|
|
101
107
|
sum += item;
|
|
102
108
|
}
|
|
103
109
|
return sum;
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
if (error instanceof _module_1.CollectionError) {
|
|
107
|
-
throw error;
|
|
108
|
-
}
|
|
109
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
110
|
-
}
|
|
110
|
+
});
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
average() {
|
|
113
|
+
return new _module_3.LazyPromise(async () => {
|
|
114
114
|
if (await this.isEmpty()) {
|
|
115
115
|
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
116
116
|
}
|
|
@@ -123,53 +123,49 @@ class AsyncIterableCollection {
|
|
|
123
123
|
sum += item;
|
|
124
124
|
}
|
|
125
125
|
return (sum / size);
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
if (error instanceof _module_1.CollectionError) {
|
|
129
|
-
throw error;
|
|
130
|
-
}
|
|
131
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
132
|
-
}
|
|
126
|
+
});
|
|
133
127
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const size = await this.size();
|
|
139
|
-
if (size === 0) {
|
|
140
|
-
return 0;
|
|
141
|
-
}
|
|
142
|
-
const isEven = size % 2 === 0, items = await this.map((item) => {
|
|
143
|
-
if (typeof item !== "number") {
|
|
144
|
-
throw new _module_1.TypeCollectionError("Item type is invalid must be number");
|
|
128
|
+
median() {
|
|
129
|
+
return new _module_3.LazyPromise(async () => {
|
|
130
|
+
if (await this.isEmpty()) {
|
|
131
|
+
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
145
132
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
133
|
+
const size = await this.size();
|
|
134
|
+
if (size === 0) {
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
const isEven = size % 2 === 0, items = await this.map((item) => {
|
|
138
|
+
if (typeof item !== "number") {
|
|
139
|
+
throw new _module_1.TypeCollectionError("Item type is invalid must be number");
|
|
140
|
+
}
|
|
141
|
+
return item;
|
|
142
|
+
})
|
|
143
|
+
.filter((_item, index) => {
|
|
144
|
+
if (isEven) {
|
|
145
|
+
return index === size / 2 || index === size / 2 - 1;
|
|
146
|
+
}
|
|
147
|
+
return index === Math.floor(size / 2);
|
|
148
|
+
})
|
|
149
|
+
.toArray();
|
|
149
150
|
if (isEven) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
throw new _module_1.UnexpectedCollectionError("Is in invalid state");
|
|
151
|
+
const [a, b] = items;
|
|
152
|
+
if (a === undefined) {
|
|
153
|
+
throw new _module_1.UnexpectedCollectionError("Is in invalid state");
|
|
154
|
+
}
|
|
155
|
+
if (b === undefined) {
|
|
156
|
+
throw new _module_1.UnexpectedCollectionError("Is in invalid state");
|
|
157
|
+
}
|
|
158
|
+
return ((a + b) / 2);
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
const [median] = items;
|
|
161
|
+
if (median === undefined) {
|
|
161
162
|
throw new _module_1.UnexpectedCollectionError("Is in invalid state");
|
|
162
163
|
}
|
|
163
|
-
return
|
|
164
|
-
}
|
|
165
|
-
const [median] = items;
|
|
166
|
-
if (median === undefined) {
|
|
167
|
-
throw new _module_1.UnexpectedCollectionError("Is in invalid state");
|
|
168
|
-
}
|
|
169
|
-
return median;
|
|
164
|
+
return median;
|
|
165
|
+
});
|
|
170
166
|
}
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
min() {
|
|
168
|
+
return new _module_3.LazyPromise(async () => {
|
|
173
169
|
if (await this.isEmpty()) {
|
|
174
170
|
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
175
171
|
}
|
|
@@ -186,16 +182,10 @@ class AsyncIterableCollection {
|
|
|
186
182
|
}
|
|
187
183
|
}
|
|
188
184
|
return min;
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
if (error instanceof _module_1.CollectionError) {
|
|
192
|
-
throw error;
|
|
193
|
-
}
|
|
194
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
195
|
-
}
|
|
185
|
+
});
|
|
196
186
|
}
|
|
197
|
-
|
|
198
|
-
|
|
187
|
+
max() {
|
|
188
|
+
return new _module_3.LazyPromise(async () => {
|
|
199
189
|
if (await this.isEmpty()) {
|
|
200
190
|
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
201
191
|
}
|
|
@@ -212,16 +202,10 @@ class AsyncIterableCollection {
|
|
|
212
202
|
}
|
|
213
203
|
}
|
|
214
204
|
return max;
|
|
215
|
-
}
|
|
216
|
-
catch (error) {
|
|
217
|
-
if (error instanceof _module_1.CollectionError) {
|
|
218
|
-
throw error;
|
|
219
|
-
}
|
|
220
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
221
|
-
}
|
|
205
|
+
});
|
|
222
206
|
}
|
|
223
|
-
|
|
224
|
-
|
|
207
|
+
percentage(predicateFn) {
|
|
208
|
+
return new _module_3.LazyPromise(async () => {
|
|
225
209
|
if (await this.isEmpty()) {
|
|
226
210
|
throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
227
211
|
}
|
|
@@ -233,32 +217,20 @@ class AsyncIterableCollection {
|
|
|
233
217
|
total++;
|
|
234
218
|
}
|
|
235
219
|
return (part / total) * 100;
|
|
236
|
-
}
|
|
237
|
-
catch (error) {
|
|
238
|
-
if (error instanceof _module_1.CollectionError) {
|
|
239
|
-
throw error;
|
|
240
|
-
}
|
|
241
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
242
|
-
}
|
|
220
|
+
});
|
|
243
221
|
}
|
|
244
|
-
|
|
245
|
-
|
|
222
|
+
some(predicateFn) {
|
|
223
|
+
return new _module_3.LazyPromise(async () => {
|
|
246
224
|
for await (const [index, item] of this.entries()) {
|
|
247
225
|
if (await predicateFn(item, index, this)) {
|
|
248
226
|
return true;
|
|
249
227
|
}
|
|
250
228
|
}
|
|
251
229
|
return false;
|
|
252
|
-
}
|
|
253
|
-
catch (error) {
|
|
254
|
-
if (error instanceof _module_1.CollectionError) {
|
|
255
|
-
throw error;
|
|
256
|
-
}
|
|
257
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
258
|
-
}
|
|
230
|
+
});
|
|
259
231
|
}
|
|
260
|
-
|
|
261
|
-
|
|
232
|
+
every(predicateFn) {
|
|
233
|
+
return new _module_3.LazyPromise(async () => {
|
|
262
234
|
let isTrue = true;
|
|
263
235
|
for await (const [index, item] of this.entries()) {
|
|
264
236
|
isTrue &&= await predicateFn(item, index, this);
|
|
@@ -267,13 +239,7 @@ class AsyncIterableCollection {
|
|
|
267
239
|
}
|
|
268
240
|
}
|
|
269
241
|
return isTrue;
|
|
270
|
-
}
|
|
271
|
-
catch (error) {
|
|
272
|
-
if (error instanceof _module_1.CollectionError) {
|
|
273
|
-
throw error;
|
|
274
|
-
}
|
|
275
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
276
|
-
}
|
|
242
|
+
});
|
|
277
243
|
}
|
|
278
244
|
take(limit) {
|
|
279
245
|
return new AsyncIterableCollection(new _module_2.AsyncTakeIterable(this, limit));
|
|
@@ -305,16 +271,10 @@ class AsyncIterableCollection {
|
|
|
305
271
|
whenNotEmpty(callback) {
|
|
306
272
|
return new AsyncIterableCollection(new _module_2.AsyncWhenIterable(this, () => this.isNotEmpty(), callback));
|
|
307
273
|
}
|
|
308
|
-
|
|
309
|
-
|
|
274
|
+
pipe(callback) {
|
|
275
|
+
return new _module_3.LazyPromise(async () => {
|
|
310
276
|
return await callback(this);
|
|
311
|
-
}
|
|
312
|
-
catch (error) {
|
|
313
|
-
if (error instanceof _module_1.CollectionError) {
|
|
314
|
-
throw error;
|
|
315
|
-
}
|
|
316
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
317
|
-
}
|
|
277
|
+
});
|
|
318
278
|
}
|
|
319
279
|
tap(callback) {
|
|
320
280
|
return new AsyncIterableCollection(new _module_2.AsyncTapIterable(this, callback));
|
|
@@ -391,37 +351,33 @@ class AsyncIterableCollection {
|
|
|
391
351
|
shuffle(mathRandom = Math.random) {
|
|
392
352
|
return new AsyncIterableCollection(new _module_2.AsyncShuffleIterable(this, mathRandom));
|
|
393
353
|
}
|
|
394
|
-
|
|
354
|
+
first(predicateFn) {
|
|
395
355
|
return this.firstOr(null, predicateFn);
|
|
396
356
|
}
|
|
397
|
-
|
|
398
|
-
|
|
357
|
+
firstOr(defaultValue, predicateFn = () => true) {
|
|
358
|
+
return new _module_3.LazyPromise(async () => {
|
|
399
359
|
for await (const [index, item] of this.entries()) {
|
|
400
360
|
if (await predicateFn(item, index, this)) {
|
|
401
361
|
return item;
|
|
402
362
|
}
|
|
403
363
|
}
|
|
404
364
|
return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
|
|
405
|
-
}
|
|
406
|
-
catch (error) {
|
|
407
|
-
if (error instanceof _module_1.CollectionError) {
|
|
408
|
-
throw error;
|
|
409
|
-
}
|
|
410
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
411
|
-
}
|
|
365
|
+
});
|
|
412
366
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
367
|
+
firstOrFail(predicateFn) {
|
|
368
|
+
return new _module_3.LazyPromise(async () => {
|
|
369
|
+
const item = await this.first(predicateFn);
|
|
370
|
+
if (item === null) {
|
|
371
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
372
|
+
}
|
|
373
|
+
return item;
|
|
374
|
+
});
|
|
419
375
|
}
|
|
420
|
-
|
|
376
|
+
last(predicateFn) {
|
|
421
377
|
return this.lastOr(null, predicateFn);
|
|
422
378
|
}
|
|
423
|
-
|
|
424
|
-
|
|
379
|
+
lastOr(defaultValue, predicateFn = () => true) {
|
|
380
|
+
return new _module_3.LazyPromise(async () => {
|
|
425
381
|
let matchedItem = null;
|
|
426
382
|
for await (const [index, item] of this.entries()) {
|
|
427
383
|
if (await predicateFn(item, index, this)) {
|
|
@@ -432,26 +388,22 @@ class AsyncIterableCollection {
|
|
|
432
388
|
return matchedItem;
|
|
433
389
|
}
|
|
434
390
|
return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
|
|
435
|
-
}
|
|
436
|
-
catch (error) {
|
|
437
|
-
if (error instanceof _module_1.CollectionError) {
|
|
438
|
-
throw error;
|
|
439
|
-
}
|
|
440
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
441
|
-
}
|
|
391
|
+
});
|
|
442
392
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
393
|
+
lastOrFail(predicateFn) {
|
|
394
|
+
return new _module_3.LazyPromise(async () => {
|
|
395
|
+
const item = await this.last(predicateFn);
|
|
396
|
+
if (item === null) {
|
|
397
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
398
|
+
}
|
|
399
|
+
return item;
|
|
400
|
+
});
|
|
449
401
|
}
|
|
450
|
-
|
|
402
|
+
before(predicateFn) {
|
|
451
403
|
return this.beforeOr(null, predicateFn);
|
|
452
404
|
}
|
|
453
|
-
|
|
454
|
-
|
|
405
|
+
beforeOr(defaultValue, predicateFn) {
|
|
406
|
+
return new _module_3.LazyPromise(async () => {
|
|
455
407
|
let beforeItem = null, index = 0;
|
|
456
408
|
for await (const item of this) {
|
|
457
409
|
if ((await predicateFn(item, index, this)) && beforeItem) {
|
|
@@ -461,26 +413,22 @@ class AsyncIterableCollection {
|
|
|
461
413
|
beforeItem = item;
|
|
462
414
|
}
|
|
463
415
|
return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
|
|
464
|
-
}
|
|
465
|
-
catch (error) {
|
|
466
|
-
if (error instanceof _module_1.CollectionError) {
|
|
467
|
-
throw error;
|
|
468
|
-
}
|
|
469
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
470
|
-
}
|
|
416
|
+
});
|
|
471
417
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
418
|
+
beforeOrFail(predicateFn) {
|
|
419
|
+
return new _module_3.LazyPromise(async () => {
|
|
420
|
+
const item = await this.before(predicateFn);
|
|
421
|
+
if (item === null) {
|
|
422
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
423
|
+
}
|
|
424
|
+
return item;
|
|
425
|
+
});
|
|
478
426
|
}
|
|
479
|
-
|
|
427
|
+
after(predicateFn) {
|
|
480
428
|
return this.afterOr(null, predicateFn);
|
|
481
429
|
}
|
|
482
|
-
|
|
483
|
-
|
|
430
|
+
afterOr(defaultValue, predicateFn) {
|
|
431
|
+
return new _module_3.LazyPromise(async () => {
|
|
484
432
|
let hasMatched = false, index = 0;
|
|
485
433
|
for await (const item of this) {
|
|
486
434
|
if (hasMatched) {
|
|
@@ -490,23 +438,19 @@ class AsyncIterableCollection {
|
|
|
490
438
|
index++;
|
|
491
439
|
}
|
|
492
440
|
return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
|
|
493
|
-
}
|
|
494
|
-
catch (error) {
|
|
495
|
-
if (error instanceof _module_1.CollectionError) {
|
|
496
|
-
throw error;
|
|
497
|
-
}
|
|
498
|
-
throw new _module_1.UnexpectedCollectionError("!!__messge__!!", error);
|
|
499
|
-
}
|
|
441
|
+
});
|
|
500
442
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
443
|
+
afterOrFail(predicateFn) {
|
|
444
|
+
return new _module_3.LazyPromise(async () => {
|
|
445
|
+
const item = await this.after(predicateFn);
|
|
446
|
+
if (item === null) {
|
|
447
|
+
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
448
|
+
}
|
|
449
|
+
return item;
|
|
450
|
+
});
|
|
507
451
|
}
|
|
508
|
-
|
|
509
|
-
|
|
452
|
+
sole(predicateFn) {
|
|
453
|
+
return new _module_3.LazyPromise(async () => {
|
|
510
454
|
let matchedItem = null;
|
|
511
455
|
for await (const [index, item] of this.entries()) {
|
|
512
456
|
if (await predicateFn(item, index, this)) {
|
|
@@ -520,28 +464,22 @@ class AsyncIterableCollection {
|
|
|
520
464
|
throw new _module_1.ItemNotFoundCollectionError("Item was not found");
|
|
521
465
|
}
|
|
522
466
|
return matchedItem;
|
|
523
|
-
}
|
|
524
|
-
catch (error) {
|
|
525
|
-
if (error instanceof _module_1.CollectionError) {
|
|
526
|
-
throw error;
|
|
527
|
-
}
|
|
528
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
529
|
-
}
|
|
467
|
+
});
|
|
530
468
|
}
|
|
531
469
|
nth(step) {
|
|
532
470
|
return this.filter((_item, index) => index % step === 0);
|
|
533
471
|
}
|
|
534
|
-
delay(
|
|
535
|
-
return new AsyncIterableCollection(
|
|
472
|
+
delay(time) {
|
|
473
|
+
return new AsyncIterableCollection((0, _module_3.delayIterable)(this, time));
|
|
536
474
|
}
|
|
537
|
-
|
|
538
|
-
return new AsyncIterableCollection(new _module_2.
|
|
475
|
+
takeUntilAbort(abortSignal) {
|
|
476
|
+
return new AsyncIterableCollection(new _module_2.AsyncErrorHandlerIterable((0, _module_3.abortableIterable)(this, abortSignal), (error) => error instanceof _module_4.AbortAsyncError));
|
|
539
477
|
}
|
|
540
|
-
|
|
541
|
-
return new AsyncIterableCollection(new _module_2.
|
|
478
|
+
takeUntilTimeout(timeInMs) {
|
|
479
|
+
return new AsyncIterableCollection(new _module_2.AsyncErrorHandlerIterable((0, _module_4.timeoutIterable)(this, timeInMs), (error) => error instanceof _module_4.TimeoutAsyncError));
|
|
542
480
|
}
|
|
543
|
-
|
|
544
|
-
|
|
481
|
+
count(predicateFn) {
|
|
482
|
+
return new _module_3.LazyPromise(async () => {
|
|
545
483
|
let size = 0;
|
|
546
484
|
for await (const item of this) {
|
|
547
485
|
if (await predicateFn(item, size, this)) {
|
|
@@ -549,52 +487,36 @@ class AsyncIterableCollection {
|
|
|
549
487
|
}
|
|
550
488
|
}
|
|
551
489
|
return size;
|
|
552
|
-
}
|
|
553
|
-
catch (error) {
|
|
554
|
-
if (error instanceof _module_1.CollectionError) {
|
|
555
|
-
throw error;
|
|
556
|
-
}
|
|
557
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
558
|
-
}
|
|
490
|
+
});
|
|
559
491
|
}
|
|
560
|
-
|
|
492
|
+
size() {
|
|
561
493
|
return this.count(() => true);
|
|
562
494
|
}
|
|
563
|
-
|
|
564
|
-
|
|
495
|
+
isEmpty() {
|
|
496
|
+
return new _module_3.LazyPromise(async () => {
|
|
565
497
|
for await (const _ of this) {
|
|
566
498
|
return false;
|
|
567
499
|
}
|
|
568
500
|
return true;
|
|
569
|
-
}
|
|
570
|
-
catch (error) {
|
|
571
|
-
if (error instanceof _module_1.CollectionError) {
|
|
572
|
-
throw error;
|
|
573
|
-
}
|
|
574
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
575
|
-
}
|
|
501
|
+
});
|
|
576
502
|
}
|
|
577
|
-
|
|
578
|
-
return
|
|
503
|
+
isNotEmpty() {
|
|
504
|
+
return new _module_3.LazyPromise(async () => {
|
|
505
|
+
return !(await this.isEmpty());
|
|
506
|
+
});
|
|
579
507
|
}
|
|
580
|
-
|
|
581
|
-
|
|
508
|
+
searchFirst(predicateFn) {
|
|
509
|
+
return new _module_3.LazyPromise(async () => {
|
|
582
510
|
for await (const [index, item] of this.entries()) {
|
|
583
511
|
if (await predicateFn(item, index, this)) {
|
|
584
512
|
return index;
|
|
585
513
|
}
|
|
586
514
|
}
|
|
587
515
|
return -1;
|
|
588
|
-
}
|
|
589
|
-
catch (error) {
|
|
590
|
-
if (error instanceof _module_1.CollectionError) {
|
|
591
|
-
throw error;
|
|
592
|
-
}
|
|
593
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
594
|
-
}
|
|
516
|
+
});
|
|
595
517
|
}
|
|
596
|
-
|
|
597
|
-
|
|
518
|
+
searchLast(predicateFn) {
|
|
519
|
+
return new _module_3.LazyPromise(async () => {
|
|
598
520
|
let matchedIndex = -1;
|
|
599
521
|
for await (const [index, item] of this.entries()) {
|
|
600
522
|
if (await predicateFn(item, index, this)) {
|
|
@@ -602,33 +524,23 @@ class AsyncIterableCollection {
|
|
|
602
524
|
}
|
|
603
525
|
}
|
|
604
526
|
return matchedIndex;
|
|
605
|
-
}
|
|
606
|
-
catch (error) {
|
|
607
|
-
if (error instanceof _module_1.CollectionError) {
|
|
608
|
-
throw error;
|
|
609
|
-
}
|
|
610
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
611
|
-
}
|
|
527
|
+
});
|
|
612
528
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
await
|
|
616
|
-
|
|
529
|
+
forEach(callback) {
|
|
530
|
+
return new _module_3.LazyPromise(async () => {
|
|
531
|
+
for await (const [index, item] of this.entries()) {
|
|
532
|
+
await callback(item, index, this);
|
|
533
|
+
}
|
|
534
|
+
});
|
|
617
535
|
}
|
|
618
|
-
|
|
619
|
-
|
|
536
|
+
toArray() {
|
|
537
|
+
return new _module_3.LazyPromise(async () => {
|
|
620
538
|
const items = [];
|
|
621
539
|
for await (const item of this) {
|
|
622
540
|
items.push(item);
|
|
623
541
|
}
|
|
624
542
|
return items;
|
|
625
|
-
}
|
|
626
|
-
catch (error) {
|
|
627
|
-
if (error instanceof _module_1.CollectionError) {
|
|
628
|
-
throw error;
|
|
629
|
-
}
|
|
630
|
-
throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
631
|
-
}
|
|
543
|
+
});
|
|
632
544
|
}
|
|
633
545
|
}
|
|
634
546
|
exports.AsyncIterableCollection = AsyncIterableCollection;
|