@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
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AsyncCrossJoinIterable, AsyncSlidingIteralbe, AsyncShuffleIterable, AsyncEntriesIterable, AsyncFilterIterable, AsyncChunkIterable, AsyncChunkWhileIterable, AsyncCollapseIterable, AsyncCountByIterable, AsyncFlatMapIterable, AsyncGroupByIterable, AsyncInsertAfterIterable, AsyncInsertBeforeIterable, AsyncMapIterable, AsyncMergeIterable, AsyncPadEndIterable, AsyncPadStartIterable, AsyncPartionIterable, AsyncSkipIterable, AsyncSkipUntilIterable, AsyncSortIterable, AsyncSplitIterable, AsyncTakeIterable, AsyncTakeUntilIterable, AsyncTapIterable, AsyncUniqueIterable, AsyncUpdateIterable, AsyncWhenIterable, AsyncZipIterable, AsyncReverseIterable, AsyncSliceIterable, AsyncRepeatIterable,
|
|
1
|
+
import { ItemNotFoundCollectionError, MultipleItemsFoundCollectionError, UnexpectedCollectionError, TypeCollectionError, EmptyCollectionError, } from "../../contracts/collection/_module";
|
|
2
|
+
import { AsyncErrorHandlerIterable, AsyncCrossJoinIterable, AsyncSlidingIteralbe, AsyncShuffleIterable, AsyncEntriesIterable, AsyncFilterIterable, AsyncChunkIterable, AsyncChunkWhileIterable, AsyncCollapseIterable, AsyncCountByIterable, AsyncFlatMapIterable, AsyncGroupByIterable, AsyncInsertAfterIterable, AsyncInsertBeforeIterable, AsyncMapIterable, AsyncMergeIterable, AsyncPadEndIterable, AsyncPadStartIterable, AsyncPartionIterable, AsyncSkipIterable, AsyncSkipUntilIterable, AsyncSortIterable, AsyncSplitIterable, AsyncTakeIterable, AsyncTakeUntilIterable, AsyncTapIterable, AsyncUniqueIterable, AsyncUpdateIterable, AsyncWhenIterable, AsyncZipIterable, AsyncReverseIterable, AsyncSliceIterable, AsyncRepeatIterable, } from "../../collection/async-iterable-collection/_shared/_module";
|
|
3
3
|
import { simplifyAsyncLazyable } from "../../_shared/utilities";
|
|
4
|
+
import { abortableIterable, delayIterable, LazyPromise } from "../../_module";
|
|
5
|
+
import { AbortAsyncError, TimeoutAsyncError, timeoutIterable, } from "../../async/_module";
|
|
4
6
|
export class AsyncIterableCollection {
|
|
5
7
|
iterable;
|
|
6
8
|
static DEFAULT_CHUNK_SIZE = 1024;
|
|
@@ -34,41 +36,45 @@ export class AsyncIterableCollection {
|
|
|
34
36
|
map(mapFn) {
|
|
35
37
|
return new AsyncIterableCollection(new AsyncMapIterable(this, mapFn));
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (initialValue !== undefined) {
|
|
42
|
-
let output = initialValue;
|
|
43
|
-
for await (const [index, item] of this.entries()) {
|
|
44
|
-
output = await reduceFn(output, item, index, this);
|
|
45
|
-
}
|
|
46
|
-
return output;
|
|
47
|
-
}
|
|
48
|
-
let output = (await this.firstOrFail()), index = 0, isFirstIteration = true;
|
|
49
|
-
for await (const item of this) {
|
|
50
|
-
if (!isFirstIteration) {
|
|
51
|
-
output = await reduceFn(output, item, index, this);
|
|
39
|
+
reduce(reduceFn, initialValue) {
|
|
40
|
+
return new LazyPromise(async () => {
|
|
41
|
+
if (initialValue === undefined && (await this.isEmpty())) {
|
|
42
|
+
throw new TypeCollectionError("Reduce of empty array must be inputed a initial value");
|
|
52
43
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let str = null;
|
|
60
|
-
for await (const item of this) {
|
|
61
|
-
if (typeof item !== "string") {
|
|
62
|
-
throw new TypeCollectionError("Item type is invalid must be string");
|
|
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;
|
|
63
50
|
}
|
|
64
|
-
|
|
65
|
-
|
|
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);
|
|
55
|
+
}
|
|
56
|
+
isFirstIteration = false;
|
|
57
|
+
index++;
|
|
66
58
|
}
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
return output;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
join(separator = ",") {
|
|
63
|
+
return new LazyPromise(async () => {
|
|
64
|
+
let str = null;
|
|
65
|
+
for await (const item of this) {
|
|
66
|
+
if (typeof item !== "string") {
|
|
67
|
+
throw new TypeCollectionError("Item type is invalid must be string");
|
|
68
|
+
}
|
|
69
|
+
if (str === null) {
|
|
70
|
+
str = item;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
str = str + separator + item;
|
|
74
|
+
}
|
|
69
75
|
}
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
return str;
|
|
77
|
+
});
|
|
72
78
|
}
|
|
73
79
|
collapse() {
|
|
74
80
|
return new AsyncIterableCollection(new AsyncCollapseIterable(this));
|
|
@@ -85,8 +91,8 @@ export class AsyncIterableCollection {
|
|
|
85
91
|
}
|
|
86
92
|
return this.skip((page - 1) * pageSize).take(pageSize);
|
|
87
93
|
}
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
sum() {
|
|
95
|
+
return new LazyPromise(async () => {
|
|
90
96
|
if (await this.isEmpty()) {
|
|
91
97
|
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
92
98
|
}
|
|
@@ -98,16 +104,10 @@ export class AsyncIterableCollection {
|
|
|
98
104
|
sum += item;
|
|
99
105
|
}
|
|
100
106
|
return sum;
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
if (error instanceof CollectionError) {
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
107
|
-
}
|
|
107
|
+
});
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
average() {
|
|
110
|
+
return new LazyPromise(async () => {
|
|
111
111
|
if (await this.isEmpty()) {
|
|
112
112
|
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
113
113
|
}
|
|
@@ -120,53 +120,49 @@ export class AsyncIterableCollection {
|
|
|
120
120
|
sum += item;
|
|
121
121
|
}
|
|
122
122
|
return (sum / size);
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
if (error instanceof CollectionError) {
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
128
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
129
|
-
}
|
|
123
|
+
});
|
|
130
124
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const size = await this.size();
|
|
136
|
-
if (size === 0) {
|
|
137
|
-
return 0;
|
|
138
|
-
}
|
|
139
|
-
const isEven = size % 2 === 0, items = await this.map((item) => {
|
|
140
|
-
if (typeof item !== "number") {
|
|
141
|
-
throw new TypeCollectionError("Item type is invalid must be number");
|
|
125
|
+
median() {
|
|
126
|
+
return new LazyPromise(async () => {
|
|
127
|
+
if (await this.isEmpty()) {
|
|
128
|
+
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
142
129
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
130
|
+
const size = await this.size();
|
|
131
|
+
if (size === 0) {
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
const isEven = size % 2 === 0, items = await this.map((item) => {
|
|
135
|
+
if (typeof item !== "number") {
|
|
136
|
+
throw new TypeCollectionError("Item type is invalid must be number");
|
|
137
|
+
}
|
|
138
|
+
return item;
|
|
139
|
+
})
|
|
140
|
+
.filter((_item, index) => {
|
|
141
|
+
if (isEven) {
|
|
142
|
+
return index === size / 2 || index === size / 2 - 1;
|
|
143
|
+
}
|
|
144
|
+
return index === Math.floor(size / 2);
|
|
145
|
+
})
|
|
146
|
+
.toArray();
|
|
146
147
|
if (isEven) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
throw new UnexpectedCollectionError("Is in invalid state");
|
|
148
|
+
const [a, b] = items;
|
|
149
|
+
if (a === undefined) {
|
|
150
|
+
throw new UnexpectedCollectionError("Is in invalid state");
|
|
151
|
+
}
|
|
152
|
+
if (b === undefined) {
|
|
153
|
+
throw new UnexpectedCollectionError("Is in invalid state");
|
|
154
|
+
}
|
|
155
|
+
return ((a + b) / 2);
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
const [median] = items;
|
|
158
|
+
if (median === undefined) {
|
|
158
159
|
throw new UnexpectedCollectionError("Is in invalid state");
|
|
159
160
|
}
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
const [median] = items;
|
|
163
|
-
if (median === undefined) {
|
|
164
|
-
throw new UnexpectedCollectionError("Is in invalid state");
|
|
165
|
-
}
|
|
166
|
-
return median;
|
|
161
|
+
return median;
|
|
162
|
+
});
|
|
167
163
|
}
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
min() {
|
|
165
|
+
return new LazyPromise(async () => {
|
|
170
166
|
if (await this.isEmpty()) {
|
|
171
167
|
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
172
168
|
}
|
|
@@ -183,16 +179,10 @@ export class AsyncIterableCollection {
|
|
|
183
179
|
}
|
|
184
180
|
}
|
|
185
181
|
return min;
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
if (error instanceof CollectionError) {
|
|
189
|
-
throw error;
|
|
190
|
-
}
|
|
191
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
192
|
-
}
|
|
182
|
+
});
|
|
193
183
|
}
|
|
194
|
-
|
|
195
|
-
|
|
184
|
+
max() {
|
|
185
|
+
return new LazyPromise(async () => {
|
|
196
186
|
if (await this.isEmpty()) {
|
|
197
187
|
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
198
188
|
}
|
|
@@ -209,16 +199,10 @@ export class AsyncIterableCollection {
|
|
|
209
199
|
}
|
|
210
200
|
}
|
|
211
201
|
return max;
|
|
212
|
-
}
|
|
213
|
-
catch (error) {
|
|
214
|
-
if (error instanceof CollectionError) {
|
|
215
|
-
throw error;
|
|
216
|
-
}
|
|
217
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
218
|
-
}
|
|
202
|
+
});
|
|
219
203
|
}
|
|
220
|
-
|
|
221
|
-
|
|
204
|
+
percentage(predicateFn) {
|
|
205
|
+
return new LazyPromise(async () => {
|
|
222
206
|
if (await this.isEmpty()) {
|
|
223
207
|
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
224
208
|
}
|
|
@@ -230,32 +214,20 @@ export class AsyncIterableCollection {
|
|
|
230
214
|
total++;
|
|
231
215
|
}
|
|
232
216
|
return (part / total) * 100;
|
|
233
|
-
}
|
|
234
|
-
catch (error) {
|
|
235
|
-
if (error instanceof CollectionError) {
|
|
236
|
-
throw error;
|
|
237
|
-
}
|
|
238
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
239
|
-
}
|
|
217
|
+
});
|
|
240
218
|
}
|
|
241
|
-
|
|
242
|
-
|
|
219
|
+
some(predicateFn) {
|
|
220
|
+
return new LazyPromise(async () => {
|
|
243
221
|
for await (const [index, item] of this.entries()) {
|
|
244
222
|
if (await predicateFn(item, index, this)) {
|
|
245
223
|
return true;
|
|
246
224
|
}
|
|
247
225
|
}
|
|
248
226
|
return false;
|
|
249
|
-
}
|
|
250
|
-
catch (error) {
|
|
251
|
-
if (error instanceof CollectionError) {
|
|
252
|
-
throw error;
|
|
253
|
-
}
|
|
254
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
255
|
-
}
|
|
227
|
+
});
|
|
256
228
|
}
|
|
257
|
-
|
|
258
|
-
|
|
229
|
+
every(predicateFn) {
|
|
230
|
+
return new LazyPromise(async () => {
|
|
259
231
|
let isTrue = true;
|
|
260
232
|
for await (const [index, item] of this.entries()) {
|
|
261
233
|
isTrue &&= await predicateFn(item, index, this);
|
|
@@ -264,13 +236,7 @@ export class AsyncIterableCollection {
|
|
|
264
236
|
}
|
|
265
237
|
}
|
|
266
238
|
return isTrue;
|
|
267
|
-
}
|
|
268
|
-
catch (error) {
|
|
269
|
-
if (error instanceof CollectionError) {
|
|
270
|
-
throw error;
|
|
271
|
-
}
|
|
272
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
273
|
-
}
|
|
239
|
+
});
|
|
274
240
|
}
|
|
275
241
|
take(limit) {
|
|
276
242
|
return new AsyncIterableCollection(new AsyncTakeIterable(this, limit));
|
|
@@ -302,16 +268,10 @@ export class AsyncIterableCollection {
|
|
|
302
268
|
whenNotEmpty(callback) {
|
|
303
269
|
return new AsyncIterableCollection(new AsyncWhenIterable(this, () => this.isNotEmpty(), callback));
|
|
304
270
|
}
|
|
305
|
-
|
|
306
|
-
|
|
271
|
+
pipe(callback) {
|
|
272
|
+
return new LazyPromise(async () => {
|
|
307
273
|
return await callback(this);
|
|
308
|
-
}
|
|
309
|
-
catch (error) {
|
|
310
|
-
if (error instanceof CollectionError) {
|
|
311
|
-
throw error;
|
|
312
|
-
}
|
|
313
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
314
|
-
}
|
|
274
|
+
});
|
|
315
275
|
}
|
|
316
276
|
tap(callback) {
|
|
317
277
|
return new AsyncIterableCollection(new AsyncTapIterable(this, callback));
|
|
@@ -388,37 +348,33 @@ export class AsyncIterableCollection {
|
|
|
388
348
|
shuffle(mathRandom = Math.random) {
|
|
389
349
|
return new AsyncIterableCollection(new AsyncShuffleIterable(this, mathRandom));
|
|
390
350
|
}
|
|
391
|
-
|
|
351
|
+
first(predicateFn) {
|
|
392
352
|
return this.firstOr(null, predicateFn);
|
|
393
353
|
}
|
|
394
|
-
|
|
395
|
-
|
|
354
|
+
firstOr(defaultValue, predicateFn = () => true) {
|
|
355
|
+
return new LazyPromise(async () => {
|
|
396
356
|
for await (const [index, item] of this.entries()) {
|
|
397
357
|
if (await predicateFn(item, index, this)) {
|
|
398
358
|
return item;
|
|
399
359
|
}
|
|
400
360
|
}
|
|
401
361
|
return await simplifyAsyncLazyable(defaultValue);
|
|
402
|
-
}
|
|
403
|
-
catch (error) {
|
|
404
|
-
if (error instanceof CollectionError) {
|
|
405
|
-
throw error;
|
|
406
|
-
}
|
|
407
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
408
|
-
}
|
|
362
|
+
});
|
|
409
363
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
364
|
+
firstOrFail(predicateFn) {
|
|
365
|
+
return new LazyPromise(async () => {
|
|
366
|
+
const item = await this.first(predicateFn);
|
|
367
|
+
if (item === null) {
|
|
368
|
+
throw new ItemNotFoundCollectionError("Item was not found");
|
|
369
|
+
}
|
|
370
|
+
return item;
|
|
371
|
+
});
|
|
416
372
|
}
|
|
417
|
-
|
|
373
|
+
last(predicateFn) {
|
|
418
374
|
return this.lastOr(null, predicateFn);
|
|
419
375
|
}
|
|
420
|
-
|
|
421
|
-
|
|
376
|
+
lastOr(defaultValue, predicateFn = () => true) {
|
|
377
|
+
return new LazyPromise(async () => {
|
|
422
378
|
let matchedItem = null;
|
|
423
379
|
for await (const [index, item] of this.entries()) {
|
|
424
380
|
if (await predicateFn(item, index, this)) {
|
|
@@ -429,26 +385,22 @@ export class AsyncIterableCollection {
|
|
|
429
385
|
return matchedItem;
|
|
430
386
|
}
|
|
431
387
|
return await simplifyAsyncLazyable(defaultValue);
|
|
432
|
-
}
|
|
433
|
-
catch (error) {
|
|
434
|
-
if (error instanceof CollectionError) {
|
|
435
|
-
throw error;
|
|
436
|
-
}
|
|
437
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
438
|
-
}
|
|
388
|
+
});
|
|
439
389
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
390
|
+
lastOrFail(predicateFn) {
|
|
391
|
+
return new LazyPromise(async () => {
|
|
392
|
+
const item = await this.last(predicateFn);
|
|
393
|
+
if (item === null) {
|
|
394
|
+
throw new ItemNotFoundCollectionError("Item was not found");
|
|
395
|
+
}
|
|
396
|
+
return item;
|
|
397
|
+
});
|
|
446
398
|
}
|
|
447
|
-
|
|
399
|
+
before(predicateFn) {
|
|
448
400
|
return this.beforeOr(null, predicateFn);
|
|
449
401
|
}
|
|
450
|
-
|
|
451
|
-
|
|
402
|
+
beforeOr(defaultValue, predicateFn) {
|
|
403
|
+
return new LazyPromise(async () => {
|
|
452
404
|
let beforeItem = null, index = 0;
|
|
453
405
|
for await (const item of this) {
|
|
454
406
|
if ((await predicateFn(item, index, this)) && beforeItem) {
|
|
@@ -458,26 +410,22 @@ export class AsyncIterableCollection {
|
|
|
458
410
|
beforeItem = item;
|
|
459
411
|
}
|
|
460
412
|
return await simplifyAsyncLazyable(defaultValue);
|
|
461
|
-
}
|
|
462
|
-
catch (error) {
|
|
463
|
-
if (error instanceof CollectionError) {
|
|
464
|
-
throw error;
|
|
465
|
-
}
|
|
466
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
467
|
-
}
|
|
413
|
+
});
|
|
468
414
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
415
|
+
beforeOrFail(predicateFn) {
|
|
416
|
+
return new LazyPromise(async () => {
|
|
417
|
+
const item = await this.before(predicateFn);
|
|
418
|
+
if (item === null) {
|
|
419
|
+
throw new ItemNotFoundCollectionError("Item was not found");
|
|
420
|
+
}
|
|
421
|
+
return item;
|
|
422
|
+
});
|
|
475
423
|
}
|
|
476
|
-
|
|
424
|
+
after(predicateFn) {
|
|
477
425
|
return this.afterOr(null, predicateFn);
|
|
478
426
|
}
|
|
479
|
-
|
|
480
|
-
|
|
427
|
+
afterOr(defaultValue, predicateFn) {
|
|
428
|
+
return new LazyPromise(async () => {
|
|
481
429
|
let hasMatched = false, index = 0;
|
|
482
430
|
for await (const item of this) {
|
|
483
431
|
if (hasMatched) {
|
|
@@ -487,23 +435,19 @@ export class AsyncIterableCollection {
|
|
|
487
435
|
index++;
|
|
488
436
|
}
|
|
489
437
|
return await simplifyAsyncLazyable(defaultValue);
|
|
490
|
-
}
|
|
491
|
-
catch (error) {
|
|
492
|
-
if (error instanceof CollectionError) {
|
|
493
|
-
throw error;
|
|
494
|
-
}
|
|
495
|
-
throw new UnexpectedCollectionError("!!__messge__!!", error);
|
|
496
|
-
}
|
|
438
|
+
});
|
|
497
439
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
440
|
+
afterOrFail(predicateFn) {
|
|
441
|
+
return new LazyPromise(async () => {
|
|
442
|
+
const item = await this.after(predicateFn);
|
|
443
|
+
if (item === null) {
|
|
444
|
+
throw new ItemNotFoundCollectionError("Item was not found");
|
|
445
|
+
}
|
|
446
|
+
return item;
|
|
447
|
+
});
|
|
504
448
|
}
|
|
505
|
-
|
|
506
|
-
|
|
449
|
+
sole(predicateFn) {
|
|
450
|
+
return new LazyPromise(async () => {
|
|
507
451
|
let matchedItem = null;
|
|
508
452
|
for await (const [index, item] of this.entries()) {
|
|
509
453
|
if (await predicateFn(item, index, this)) {
|
|
@@ -517,28 +461,22 @@ export class AsyncIterableCollection {
|
|
|
517
461
|
throw new ItemNotFoundCollectionError("Item was not found");
|
|
518
462
|
}
|
|
519
463
|
return matchedItem;
|
|
520
|
-
}
|
|
521
|
-
catch (error) {
|
|
522
|
-
if (error instanceof CollectionError) {
|
|
523
|
-
throw error;
|
|
524
|
-
}
|
|
525
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
526
|
-
}
|
|
464
|
+
});
|
|
527
465
|
}
|
|
528
466
|
nth(step) {
|
|
529
467
|
return this.filter((_item, index) => index % step === 0);
|
|
530
468
|
}
|
|
531
|
-
delay(
|
|
532
|
-
return new AsyncIterableCollection(
|
|
469
|
+
delay(time) {
|
|
470
|
+
return new AsyncIterableCollection(delayIterable(this, time));
|
|
533
471
|
}
|
|
534
|
-
|
|
535
|
-
return new AsyncIterableCollection(new
|
|
472
|
+
takeUntilAbort(abortSignal) {
|
|
473
|
+
return new AsyncIterableCollection(new AsyncErrorHandlerIterable(abortableIterable(this, abortSignal), (error) => error instanceof AbortAsyncError));
|
|
536
474
|
}
|
|
537
|
-
|
|
538
|
-
return new AsyncIterableCollection(new
|
|
475
|
+
takeUntilTimeout(timeInMs) {
|
|
476
|
+
return new AsyncIterableCollection(new AsyncErrorHandlerIterable(timeoutIterable(this, timeInMs), (error) => error instanceof TimeoutAsyncError));
|
|
539
477
|
}
|
|
540
|
-
|
|
541
|
-
|
|
478
|
+
count(predicateFn) {
|
|
479
|
+
return new LazyPromise(async () => {
|
|
542
480
|
let size = 0;
|
|
543
481
|
for await (const item of this) {
|
|
544
482
|
if (await predicateFn(item, size, this)) {
|
|
@@ -546,52 +484,36 @@ export class AsyncIterableCollection {
|
|
|
546
484
|
}
|
|
547
485
|
}
|
|
548
486
|
return size;
|
|
549
|
-
}
|
|
550
|
-
catch (error) {
|
|
551
|
-
if (error instanceof CollectionError) {
|
|
552
|
-
throw error;
|
|
553
|
-
}
|
|
554
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
555
|
-
}
|
|
487
|
+
});
|
|
556
488
|
}
|
|
557
|
-
|
|
489
|
+
size() {
|
|
558
490
|
return this.count(() => true);
|
|
559
491
|
}
|
|
560
|
-
|
|
561
|
-
|
|
492
|
+
isEmpty() {
|
|
493
|
+
return new LazyPromise(async () => {
|
|
562
494
|
for await (const _ of this) {
|
|
563
495
|
return false;
|
|
564
496
|
}
|
|
565
497
|
return true;
|
|
566
|
-
}
|
|
567
|
-
catch (error) {
|
|
568
|
-
if (error instanceof CollectionError) {
|
|
569
|
-
throw error;
|
|
570
|
-
}
|
|
571
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
572
|
-
}
|
|
498
|
+
});
|
|
573
499
|
}
|
|
574
|
-
|
|
575
|
-
return
|
|
500
|
+
isNotEmpty() {
|
|
501
|
+
return new LazyPromise(async () => {
|
|
502
|
+
return !(await this.isEmpty());
|
|
503
|
+
});
|
|
576
504
|
}
|
|
577
|
-
|
|
578
|
-
|
|
505
|
+
searchFirst(predicateFn) {
|
|
506
|
+
return new LazyPromise(async () => {
|
|
579
507
|
for await (const [index, item] of this.entries()) {
|
|
580
508
|
if (await predicateFn(item, index, this)) {
|
|
581
509
|
return index;
|
|
582
510
|
}
|
|
583
511
|
}
|
|
584
512
|
return -1;
|
|
585
|
-
}
|
|
586
|
-
catch (error) {
|
|
587
|
-
if (error instanceof CollectionError) {
|
|
588
|
-
throw error;
|
|
589
|
-
}
|
|
590
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
591
|
-
}
|
|
513
|
+
});
|
|
592
514
|
}
|
|
593
|
-
|
|
594
|
-
|
|
515
|
+
searchLast(predicateFn) {
|
|
516
|
+
return new LazyPromise(async () => {
|
|
595
517
|
let matchedIndex = -1;
|
|
596
518
|
for await (const [index, item] of this.entries()) {
|
|
597
519
|
if (await predicateFn(item, index, this)) {
|
|
@@ -599,33 +521,23 @@ export class AsyncIterableCollection {
|
|
|
599
521
|
}
|
|
600
522
|
}
|
|
601
523
|
return matchedIndex;
|
|
602
|
-
}
|
|
603
|
-
catch (error) {
|
|
604
|
-
if (error instanceof CollectionError) {
|
|
605
|
-
throw error;
|
|
606
|
-
}
|
|
607
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
608
|
-
}
|
|
524
|
+
});
|
|
609
525
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
await
|
|
613
|
-
|
|
526
|
+
forEach(callback) {
|
|
527
|
+
return new LazyPromise(async () => {
|
|
528
|
+
for await (const [index, item] of this.entries()) {
|
|
529
|
+
await callback(item, index, this);
|
|
530
|
+
}
|
|
531
|
+
});
|
|
614
532
|
}
|
|
615
|
-
|
|
616
|
-
|
|
533
|
+
toArray() {
|
|
534
|
+
return new LazyPromise(async () => {
|
|
617
535
|
const items = [];
|
|
618
536
|
for await (const item of this) {
|
|
619
537
|
items.push(item);
|
|
620
538
|
}
|
|
621
539
|
return items;
|
|
622
|
-
}
|
|
623
|
-
catch (error) {
|
|
624
|
-
if (error instanceof CollectionError) {
|
|
625
|
-
throw error;
|
|
626
|
-
}
|
|
627
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
628
|
-
}
|
|
540
|
+
});
|
|
629
541
|
}
|
|
630
542
|
}
|
|
631
543
|
//# sourceMappingURL=async-iterable-collection.js.map
|