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