@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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ItemNotFoundCollectionError, MultipleItemsFoundCollectionError, UnexpectedCollectionError, TypeCollectionError, EmptyCollectionError, } from "../../contracts/collection/_module";
|
|
2
2
|
import { CrossJoinIterable, SlidingIteralbe, ShuffleIterable, EntriesIterable, FilterIterable, ChunkIterable, ChunkWhileIterable, CollapseIterable, CountByIterable, FlatMapIterable, GroupByIterable, InsertAfterIterable, InsertBeforeIterable, MapIterable, MergeIterable, PadEndIterable, PadStartIterable, PartionIterable, SkipIterable, SkipUntilIterable, SortIterable, SplitIterable, TakeIterable, TakeUntilIterable, TapIterable, UniqueIterable, UpdateIterable, WhenIterable, ZipIterable, ReverseIterable, SliceIterable, RepeatIterable, } from "../../collection/iterable-collection/_shared/_module";
|
|
3
3
|
import { simplifyLazyable } from "../../_shared/utilities";
|
|
4
4
|
export class IterableCollection {
|
|
@@ -11,15 +11,7 @@ export class IterableCollection {
|
|
|
11
11
|
this.iterable = iterable;
|
|
12
12
|
}
|
|
13
13
|
*[Symbol.iterator]() {
|
|
14
|
-
|
|
15
|
-
yield* this.iterable;
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
if (error instanceof CollectionError) {
|
|
19
|
-
throw error;
|
|
20
|
-
}
|
|
21
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
22
|
-
}
|
|
14
|
+
yield* this.iterable;
|
|
23
15
|
}
|
|
24
16
|
toIterator() {
|
|
25
17
|
return this[Symbol.iterator]();
|
|
@@ -43,57 +35,41 @@ export class IterableCollection {
|
|
|
43
35
|
return new IterableCollection(new MapIterable(this, mapFn));
|
|
44
36
|
}
|
|
45
37
|
reduce(reduceFn, initialValue) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let output = initialValue, index = 0;
|
|
52
|
-
for (const item of this) {
|
|
53
|
-
output = reduceFn(output, item, index, this);
|
|
54
|
-
index++;
|
|
55
|
-
}
|
|
56
|
-
return output;
|
|
57
|
-
}
|
|
58
|
-
let output = this.firstOrFail(), index = 0, isFirstIteration = true;
|
|
38
|
+
if (initialValue === undefined && this.isEmpty()) {
|
|
39
|
+
throw new TypeCollectionError("Reduce of empty array must be inputed a initial value");
|
|
40
|
+
}
|
|
41
|
+
if (initialValue !== undefined) {
|
|
42
|
+
let output = initialValue, index = 0;
|
|
59
43
|
for (const item of this) {
|
|
60
|
-
|
|
61
|
-
output = reduceFn(output, item, index, this);
|
|
62
|
-
}
|
|
63
|
-
isFirstIteration = false;
|
|
44
|
+
output = reduceFn(output, item, index, this);
|
|
64
45
|
index++;
|
|
65
46
|
}
|
|
66
47
|
return output;
|
|
67
48
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
49
|
+
let output = this.firstOrFail(), index = 0, isFirstIteration = true;
|
|
50
|
+
for (const item of this) {
|
|
51
|
+
if (!isFirstIteration) {
|
|
52
|
+
output = reduceFn(output, item, index, this);
|
|
71
53
|
}
|
|
72
|
-
|
|
54
|
+
isFirstIteration = false;
|
|
55
|
+
index++;
|
|
73
56
|
}
|
|
57
|
+
return output;
|
|
74
58
|
}
|
|
75
59
|
join(separator = ",") {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
throw new TypeCollectionError("Item type is invalid must be string");
|
|
81
|
-
}
|
|
82
|
-
if (str === null) {
|
|
83
|
-
str = item;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
str = str + separator + item;
|
|
87
|
-
}
|
|
60
|
+
let str = null;
|
|
61
|
+
for (const item of this) {
|
|
62
|
+
if (typeof item !== "string") {
|
|
63
|
+
throw new TypeCollectionError("Item type is invalid must be string");
|
|
88
64
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
65
|
+
if (str === null) {
|
|
66
|
+
str = item;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
str = str + separator + item;
|
|
94
70
|
}
|
|
95
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
96
71
|
}
|
|
72
|
+
return str;
|
|
97
73
|
}
|
|
98
74
|
collapse() {
|
|
99
75
|
return new IterableCollection(new CollapseIterable(this));
|
|
@@ -111,47 +87,31 @@ export class IterableCollection {
|
|
|
111
87
|
return this.skip((page - 1) * pageSize).take(pageSize);
|
|
112
88
|
}
|
|
113
89
|
sum() {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
117
|
-
}
|
|
118
|
-
let sum = 0;
|
|
119
|
-
for (const item of this) {
|
|
120
|
-
if (typeof item !== "number") {
|
|
121
|
-
throw new TypeCollectionError("Item type is invalid must be number");
|
|
122
|
-
}
|
|
123
|
-
sum += item;
|
|
124
|
-
}
|
|
125
|
-
return sum;
|
|
90
|
+
if (this.isEmpty()) {
|
|
91
|
+
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
126
92
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
93
|
+
let sum = 0;
|
|
94
|
+
for (const item of this) {
|
|
95
|
+
if (typeof item !== "number") {
|
|
96
|
+
throw new TypeCollectionError("Item type is invalid must be number");
|
|
130
97
|
}
|
|
131
|
-
|
|
98
|
+
sum += item;
|
|
132
99
|
}
|
|
100
|
+
return sum;
|
|
133
101
|
}
|
|
134
102
|
average() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
138
|
-
}
|
|
139
|
-
let size = 0, sum = 0;
|
|
140
|
-
for (const item of this) {
|
|
141
|
-
if (typeof item !== "number") {
|
|
142
|
-
throw new TypeCollectionError("Item type is invalid must be number");
|
|
143
|
-
}
|
|
144
|
-
size++;
|
|
145
|
-
sum += item;
|
|
146
|
-
}
|
|
147
|
-
return (sum / size);
|
|
103
|
+
if (this.isEmpty()) {
|
|
104
|
+
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
148
105
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
106
|
+
let size = 0, sum = 0;
|
|
107
|
+
for (const item of this) {
|
|
108
|
+
if (typeof item !== "number") {
|
|
109
|
+
throw new TypeCollectionError("Item type is invalid must be number");
|
|
152
110
|
}
|
|
153
|
-
|
|
111
|
+
size++;
|
|
112
|
+
sum += item;
|
|
154
113
|
}
|
|
114
|
+
return (sum / size);
|
|
155
115
|
}
|
|
156
116
|
median() {
|
|
157
117
|
if (this.isEmpty()) {
|
|
@@ -191,114 +151,74 @@ export class IterableCollection {
|
|
|
191
151
|
return median;
|
|
192
152
|
}
|
|
193
153
|
min() {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
154
|
+
if (this.isEmpty()) {
|
|
155
|
+
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
156
|
+
}
|
|
157
|
+
let min = 0;
|
|
158
|
+
for (const item of this) {
|
|
159
|
+
if (typeof item !== "number") {
|
|
160
|
+
throw new TypeCollectionError("Item type is invalid must be number");
|
|
197
161
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (typeof item !== "number") {
|
|
201
|
-
throw new TypeCollectionError("Item type is invalid must be number");
|
|
202
|
-
}
|
|
203
|
-
if (min === 0) {
|
|
204
|
-
min = item;
|
|
205
|
-
}
|
|
206
|
-
else if (min > item) {
|
|
207
|
-
min = item;
|
|
208
|
-
}
|
|
162
|
+
if (min === 0) {
|
|
163
|
+
min = item;
|
|
209
164
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
catch (error) {
|
|
213
|
-
if (error instanceof CollectionError) {
|
|
214
|
-
throw error;
|
|
165
|
+
else if (min > item) {
|
|
166
|
+
min = item;
|
|
215
167
|
}
|
|
216
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
217
168
|
}
|
|
169
|
+
return min;
|
|
218
170
|
}
|
|
219
171
|
max() {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
172
|
+
if (this.isEmpty()) {
|
|
173
|
+
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
174
|
+
}
|
|
175
|
+
let max = 0;
|
|
176
|
+
for (const item of this) {
|
|
177
|
+
if (typeof item !== "number") {
|
|
178
|
+
throw new TypeCollectionError("Item type is invalid must be number");
|
|
223
179
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (typeof item !== "number") {
|
|
227
|
-
throw new TypeCollectionError("Item type is invalid must be number");
|
|
228
|
-
}
|
|
229
|
-
if (max === 0) {
|
|
230
|
-
max = item;
|
|
231
|
-
}
|
|
232
|
-
else if (max < item) {
|
|
233
|
-
max = item;
|
|
234
|
-
}
|
|
180
|
+
if (max === 0) {
|
|
181
|
+
max = item;
|
|
235
182
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
catch (error) {
|
|
239
|
-
if (error instanceof CollectionError) {
|
|
240
|
-
throw error;
|
|
183
|
+
else if (max < item) {
|
|
184
|
+
max = item;
|
|
241
185
|
}
|
|
242
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
243
186
|
}
|
|
187
|
+
return max;
|
|
244
188
|
}
|
|
245
189
|
percentage(predicateFn) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
249
|
-
}
|
|
250
|
-
let part = 0, total = 0;
|
|
251
|
-
for (const item of this) {
|
|
252
|
-
if (predicateFn(item, total, this)) {
|
|
253
|
-
part++;
|
|
254
|
-
}
|
|
255
|
-
total++;
|
|
256
|
-
}
|
|
257
|
-
return (part / total) * 100;
|
|
190
|
+
if (this.isEmpty()) {
|
|
191
|
+
throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
|
|
258
192
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
193
|
+
let part = 0, total = 0;
|
|
194
|
+
for (const item of this) {
|
|
195
|
+
if (predicateFn(item, total, this)) {
|
|
196
|
+
part++;
|
|
262
197
|
}
|
|
263
|
-
|
|
198
|
+
total++;
|
|
264
199
|
}
|
|
200
|
+
return (part / total) * 100;
|
|
265
201
|
}
|
|
266
202
|
some(predicateFn) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return true;
|
|
272
|
-
}
|
|
273
|
-
index++;
|
|
274
|
-
}
|
|
275
|
-
return false;
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
if (error instanceof CollectionError) {
|
|
279
|
-
throw error;
|
|
203
|
+
let index = 0;
|
|
204
|
+
for (const item of this) {
|
|
205
|
+
if (predicateFn(item, index, this)) {
|
|
206
|
+
return true;
|
|
280
207
|
}
|
|
281
|
-
|
|
208
|
+
index++;
|
|
282
209
|
}
|
|
210
|
+
return false;
|
|
283
211
|
}
|
|
284
212
|
every(predicateFn) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
index++;
|
|
213
|
+
let index = 0, isTrue = true;
|
|
214
|
+
for (const item of this) {
|
|
215
|
+
isTrue &&= predicateFn(item, index, this);
|
|
216
|
+
if (!isTrue) {
|
|
217
|
+
break;
|
|
293
218
|
}
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
catch (error) {
|
|
297
|
-
if (error instanceof CollectionError) {
|
|
298
|
-
throw error;
|
|
299
|
-
}
|
|
300
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
219
|
+
index++;
|
|
301
220
|
}
|
|
221
|
+
return isTrue;
|
|
302
222
|
}
|
|
303
223
|
take(limit) {
|
|
304
224
|
return new IterableCollection(new TakeIterable(this, limit));
|
|
@@ -331,15 +251,7 @@ export class IterableCollection {
|
|
|
331
251
|
return new IterableCollection(new WhenIterable(this, () => this.isNotEmpty(), callback));
|
|
332
252
|
}
|
|
333
253
|
pipe(callback) {
|
|
334
|
-
|
|
335
|
-
return callback(this);
|
|
336
|
-
}
|
|
337
|
-
catch (error) {
|
|
338
|
-
if (error instanceof CollectionError) {
|
|
339
|
-
throw error;
|
|
340
|
-
}
|
|
341
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
342
|
-
}
|
|
254
|
+
return callback(this);
|
|
343
255
|
}
|
|
344
256
|
tap(callback) {
|
|
345
257
|
return new IterableCollection(new TapIterable(this, callback));
|
|
@@ -417,33 +329,17 @@ export class IterableCollection {
|
|
|
417
329
|
return new IterableCollection(new ShuffleIterable(this, mathRandom));
|
|
418
330
|
}
|
|
419
331
|
first(predicateFn) {
|
|
420
|
-
|
|
421
|
-
return this.firstOr(null, predicateFn);
|
|
422
|
-
}
|
|
423
|
-
catch (error) {
|
|
424
|
-
if (error instanceof CollectionError) {
|
|
425
|
-
throw error;
|
|
426
|
-
}
|
|
427
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
428
|
-
}
|
|
332
|
+
return this.firstOr(null, predicateFn);
|
|
429
333
|
}
|
|
430
334
|
firstOr(defaultValue, predicateFn = () => true) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
return item;
|
|
436
|
-
}
|
|
437
|
-
index++;
|
|
438
|
-
}
|
|
439
|
-
return simplifyLazyable(defaultValue);
|
|
440
|
-
}
|
|
441
|
-
catch (error) {
|
|
442
|
-
if (error instanceof CollectionError) {
|
|
443
|
-
throw error;
|
|
335
|
+
let index = 0;
|
|
336
|
+
for (const item of this) {
|
|
337
|
+
if (predicateFn(item, index, this)) {
|
|
338
|
+
return item;
|
|
444
339
|
}
|
|
445
|
-
|
|
340
|
+
index++;
|
|
446
341
|
}
|
|
342
|
+
return simplifyLazyable(defaultValue);
|
|
447
343
|
}
|
|
448
344
|
firstOrFail(predicateFn) {
|
|
449
345
|
const item = this.first(predicateFn);
|
|
@@ -453,37 +349,21 @@ export class IterableCollection {
|
|
|
453
349
|
return item;
|
|
454
350
|
}
|
|
455
351
|
last(predicateFn) {
|
|
456
|
-
|
|
457
|
-
return this.lastOr(null, predicateFn);
|
|
458
|
-
}
|
|
459
|
-
catch (error) {
|
|
460
|
-
if (error instanceof CollectionError) {
|
|
461
|
-
throw error;
|
|
462
|
-
}
|
|
463
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
464
|
-
}
|
|
352
|
+
return this.lastOr(null, predicateFn);
|
|
465
353
|
}
|
|
466
354
|
lastOr(defaultValue, predicateFn = () => true) {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
matchedItem = item;
|
|
473
|
-
}
|
|
474
|
-
index++;
|
|
355
|
+
let index = 0;
|
|
356
|
+
let matchedItem = null;
|
|
357
|
+
for (const item of this) {
|
|
358
|
+
if (predicateFn(item, index, this)) {
|
|
359
|
+
matchedItem = item;
|
|
475
360
|
}
|
|
476
|
-
|
|
477
|
-
return matchedItem;
|
|
478
|
-
}
|
|
479
|
-
return simplifyLazyable(defaultValue);
|
|
361
|
+
index++;
|
|
480
362
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
throw error;
|
|
484
|
-
}
|
|
485
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
363
|
+
if (matchedItem) {
|
|
364
|
+
return matchedItem;
|
|
486
365
|
}
|
|
366
|
+
return simplifyLazyable(defaultValue);
|
|
487
367
|
}
|
|
488
368
|
lastOrFail(predicateFn) {
|
|
489
369
|
const item = this.last(predicateFn);
|
|
@@ -496,23 +376,15 @@ export class IterableCollection {
|
|
|
496
376
|
return this.beforeOr(null, predicateFn);
|
|
497
377
|
}
|
|
498
378
|
beforeOr(defaultValue, predicateFn) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
return beforeItem;
|
|
504
|
-
}
|
|
505
|
-
index++;
|
|
506
|
-
beforeItem = item;
|
|
379
|
+
let beforeItem = null, index = 0;
|
|
380
|
+
for (const item of this) {
|
|
381
|
+
if (predicateFn(item, index, this) && beforeItem) {
|
|
382
|
+
return beforeItem;
|
|
507
383
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
catch (error) {
|
|
511
|
-
if (error instanceof CollectionError) {
|
|
512
|
-
throw error;
|
|
513
|
-
}
|
|
514
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
384
|
+
index++;
|
|
385
|
+
beforeItem = item;
|
|
515
386
|
}
|
|
387
|
+
return simplifyLazyable(defaultValue);
|
|
516
388
|
}
|
|
517
389
|
beforeOrFail(predicateFn) {
|
|
518
390
|
const item = this.before(predicateFn);
|
|
@@ -525,23 +397,15 @@ export class IterableCollection {
|
|
|
525
397
|
return this.afterOr(null, predicateFn);
|
|
526
398
|
}
|
|
527
399
|
afterOr(defaultValue, predicateFn) {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
return item;
|
|
533
|
-
}
|
|
534
|
-
hasMatched = predicateFn(item, index, this);
|
|
535
|
-
index++;
|
|
536
|
-
}
|
|
537
|
-
return simplifyLazyable(defaultValue);
|
|
538
|
-
}
|
|
539
|
-
catch (error) {
|
|
540
|
-
if (error instanceof CollectionError) {
|
|
541
|
-
throw error;
|
|
400
|
+
let hasMatched = false, index = 0;
|
|
401
|
+
for (const item of this) {
|
|
402
|
+
if (hasMatched) {
|
|
403
|
+
return item;
|
|
542
404
|
}
|
|
543
|
-
|
|
405
|
+
hasMatched = predicateFn(item, index, this);
|
|
406
|
+
index++;
|
|
544
407
|
}
|
|
408
|
+
return simplifyLazyable(defaultValue);
|
|
545
409
|
}
|
|
546
410
|
afterOrFail(predicateFn) {
|
|
547
411
|
const item = this.after(predicateFn);
|
|
@@ -551,131 +415,75 @@ export class IterableCollection {
|
|
|
551
415
|
return item;
|
|
552
416
|
}
|
|
553
417
|
sole(predicateFn) {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
if (
|
|
558
|
-
|
|
559
|
-
throw new MultipleItemsFoundCollectionError("Multiple items were found");
|
|
560
|
-
}
|
|
561
|
-
matchedItem = item;
|
|
418
|
+
let index = 0, matchedItem = null;
|
|
419
|
+
for (const item of this) {
|
|
420
|
+
if (predicateFn(item, index, this)) {
|
|
421
|
+
if (matchedItem !== null) {
|
|
422
|
+
throw new MultipleItemsFoundCollectionError("Multiple items were found");
|
|
562
423
|
}
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
if (matchedItem === null) {
|
|
566
|
-
throw new ItemNotFoundCollectionError("Item was not found");
|
|
424
|
+
matchedItem = item;
|
|
567
425
|
}
|
|
568
|
-
|
|
426
|
+
index++;
|
|
569
427
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
throw error;
|
|
573
|
-
}
|
|
574
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
428
|
+
if (matchedItem === null) {
|
|
429
|
+
throw new ItemNotFoundCollectionError("Item was not found");
|
|
575
430
|
}
|
|
431
|
+
return matchedItem;
|
|
576
432
|
}
|
|
577
433
|
nth(step) {
|
|
578
434
|
return this.filter((_item, index) => index % step === 0);
|
|
579
435
|
}
|
|
580
436
|
count(predicateFn) {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
size++;
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
return size;
|
|
589
|
-
}
|
|
590
|
-
catch (error) {
|
|
591
|
-
if (error instanceof CollectionError) {
|
|
592
|
-
throw error;
|
|
437
|
+
let size = 0;
|
|
438
|
+
for (const item of this) {
|
|
439
|
+
if (predicateFn(item, size, this)) {
|
|
440
|
+
size++;
|
|
593
441
|
}
|
|
594
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
595
442
|
}
|
|
443
|
+
return size;
|
|
596
444
|
}
|
|
597
445
|
size() {
|
|
598
446
|
return this.count(() => true);
|
|
599
447
|
}
|
|
600
448
|
isEmpty() {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
return false;
|
|
604
|
-
}
|
|
605
|
-
return true;
|
|
606
|
-
}
|
|
607
|
-
catch (error) {
|
|
608
|
-
if (error instanceof CollectionError) {
|
|
609
|
-
throw error;
|
|
610
|
-
}
|
|
611
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
449
|
+
for (const _ of this) {
|
|
450
|
+
return false;
|
|
612
451
|
}
|
|
452
|
+
return true;
|
|
613
453
|
}
|
|
614
454
|
isNotEmpty() {
|
|
615
455
|
return !this.isEmpty();
|
|
616
456
|
}
|
|
617
457
|
searchFirst(predicateFn) {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
return index;
|
|
623
|
-
}
|
|
624
|
-
index++;
|
|
625
|
-
}
|
|
626
|
-
return -1;
|
|
627
|
-
}
|
|
628
|
-
catch (error) {
|
|
629
|
-
if (error instanceof CollectionError) {
|
|
630
|
-
throw error;
|
|
458
|
+
let index = 0;
|
|
459
|
+
for (const item of this) {
|
|
460
|
+
if (predicateFn(item, index, this)) {
|
|
461
|
+
return index;
|
|
631
462
|
}
|
|
632
|
-
|
|
463
|
+
index++;
|
|
633
464
|
}
|
|
465
|
+
return -1;
|
|
634
466
|
}
|
|
635
467
|
searchLast(predicateFn) {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
matchedIndex = index;
|
|
642
|
-
}
|
|
643
|
-
index++;
|
|
644
|
-
}
|
|
645
|
-
return matchedIndex;
|
|
646
|
-
}
|
|
647
|
-
catch (error) {
|
|
648
|
-
if (error instanceof CollectionError) {
|
|
649
|
-
throw error;
|
|
468
|
+
let index = 0;
|
|
469
|
+
let matchedIndex = -1;
|
|
470
|
+
for (const item of this) {
|
|
471
|
+
if (predicateFn(item, index, this)) {
|
|
472
|
+
matchedIndex = index;
|
|
650
473
|
}
|
|
651
|
-
|
|
474
|
+
index++;
|
|
652
475
|
}
|
|
476
|
+
return matchedIndex;
|
|
653
477
|
}
|
|
654
478
|
forEach(callback) {
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
index++;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
catch (error) {
|
|
663
|
-
if (error instanceof CollectionError) {
|
|
664
|
-
throw error;
|
|
665
|
-
}
|
|
666
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
479
|
+
let index = 0;
|
|
480
|
+
for (const item of this) {
|
|
481
|
+
callback(item, index, this);
|
|
482
|
+
index++;
|
|
667
483
|
}
|
|
668
484
|
}
|
|
669
485
|
toArray() {
|
|
670
|
-
|
|
671
|
-
return [...this];
|
|
672
|
-
}
|
|
673
|
-
catch (error) {
|
|
674
|
-
if (error instanceof CollectionError) {
|
|
675
|
-
throw error;
|
|
676
|
-
}
|
|
677
|
-
throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
|
|
678
|
-
}
|
|
486
|
+
return [...this];
|
|
679
487
|
}
|
|
680
488
|
}
|
|
681
489
|
//# sourceMappingURL=iterable-collection.js.map
|