ts-data-forge 5.0.1 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -50
- package/dist/array/impl/array-utils-creation.d.mts +14 -0
- package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-creation.mjs +12 -0
- package/dist/array/impl/array-utils-creation.mjs.map +1 -1
- package/dist/array/impl/array-utils-element-access.d.mts +10 -0
- package/dist/array/impl/array-utils-element-access.d.mts.map +1 -1
- package/dist/array/impl/array-utils-element-access.mjs +6 -0
- package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
- package/dist/array/impl/array-utils-modification.d.mts +14 -0
- package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
- package/dist/array/impl/array-utils-modification.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.d.mts +34 -10
- package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.d.mts +34 -4
- package/dist/array/impl/array-utils-search.d.mts.map +1 -1
- package/dist/array/impl/array-utils-search.mjs.map +1 -1
- package/dist/array/impl/array-utils-set-op.d.mts +20 -7
- package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
- package/dist/array/impl/array-utils-set-op.mjs +20 -7
- package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
- package/dist/array/impl/array-utils-size.d.mts +5 -2
- package/dist/array/impl/array-utils-size.d.mts.map +1 -1
- package/dist/array/impl/array-utils-size.mjs +5 -2
- package/dist/array/impl/array-utils-size.mjs.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.d.mts +2 -0
- package/dist/array/impl/array-utils-slice-clamped.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
- package/dist/array/impl/array-utils-slicing.d.mts +17 -2
- package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slicing.mjs +9 -2
- package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.d.mts +27 -0
- package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +6 -0
- package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
- package/dist/array/impl/array-utils-validation.d.mts +35 -18
- package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +25 -14
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.d.mts +35 -15
- package/dist/collections/imap.d.mts.map +1 -1
- package/dist/collections/imap.mjs +5 -3
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/iset-mapped.d.mts +46 -19
- package/dist/collections/iset-mapped.d.mts.map +1 -1
- package/dist/collections/iset-mapped.mjs +9 -2
- package/dist/collections/iset-mapped.mjs.map +1 -1
- package/dist/collections/iset.d.mts +48 -19
- package/dist/collections/iset.d.mts.map +1 -1
- package/dist/collections/iset.mjs +9 -2
- package/dist/collections/iset.mjs.map +1 -1
- package/dist/collections/queue.d.mts +65 -25
- package/dist/collections/queue.d.mts.map +1 -1
- package/dist/collections/queue.mjs +13 -5
- package/dist/collections/queue.mjs.map +1 -1
- package/dist/collections/stack.d.mts +60 -25
- package/dist/collections/stack.d.mts.map +1 -1
- package/dist/collections/stack.mjs +12 -5
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/entry-point.mjs +1 -1
- package/dist/functional/match.d.mts +1 -1
- package/dist/functional/match.d.mts.map +1 -1
- package/dist/functional/match.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts +3 -2
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-filter.d.mts +3 -0
- package/dist/functional/optional/impl/optional-filter.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-filter.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-flat-map.d.mts +2 -0
- package/dist/functional/optional/impl/optional-flat-map.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-from-nullable.d.mts +2 -0
- package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-from-nullable.mjs +2 -0
- package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-none.d.mts +1 -1
- package/dist/functional/optional/impl/optional-is-none.mjs +1 -1
- package/dist/functional/optional/impl/optional-is-optional.d.mts +4 -2
- package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-optional.mjs +4 -2
- package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.d.mts +2 -1
- package/dist/functional/optional/impl/optional-is-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.mjs +2 -1
- package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-map.d.mts +2 -0
- package/dist/functional/optional/impl/optional-map.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-map.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-none.d.mts +4 -2
- package/dist/functional/optional/impl/optional-none.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-none.mjs +4 -2
- package/dist/functional/optional/impl/optional-none.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-or-else.d.mts +4 -0
- package/dist/functional/optional/impl/optional-or-else.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-some.d.mts +5 -3
- package/dist/functional/optional/impl/optional-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-some.mjs +4 -2
- package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.d.mts +4 -2
- package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.mjs +4 -2
- package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts +7 -4
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +2 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs +2 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap.d.mts +4 -2
- package/dist/functional/optional/impl/optional-unwrap.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-zip.d.mts +3 -1
- package/dist/functional/optional/impl/optional-zip.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-zip.mjs +3 -1
- package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
- package/dist/functional/pipe.d.mts +2 -2
- package/dist/functional/result/impl/result-err.d.mts +4 -2
- package/dist/functional/result/impl/result-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-err.mjs +3 -1
- package/dist/functional/result/impl/result-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.d.mts +3 -2
- package/dist/functional/result/impl/result-expect-to-be.d.mts.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
- package/dist/functional/result/impl/result-flat-map.d.mts +5 -0
- package/dist/functional/result/impl/result-flat-map.d.mts.map +1 -1
- package/dist/functional/result/impl/result-flat-map.mjs.map +1 -1
- package/dist/functional/result/impl/result-fold.d.mts +4 -0
- package/dist/functional/result/impl/result-fold.d.mts.map +1 -1
- package/dist/functional/result/impl/result-fold.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-promise.d.mts +4 -1
- package/dist/functional/result/impl/result-from-promise.d.mts.map +1 -1
- package/dist/functional/result/impl/result-from-promise.mjs +4 -1
- package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.d.mts +3 -1
- package/dist/functional/result/impl/result-from-throwable.d.mts.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.mjs +3 -1
- package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-err.d.mts +4 -2
- package/dist/functional/result/impl/result-is-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-err.mjs +4 -2
- package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-ok.d.mts +4 -2
- package/dist/functional/result/impl/result-is-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-ok.mjs +4 -2
- package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-result.d.mts +7 -3
- package/dist/functional/result/impl/result-is-result.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-result.mjs +7 -3
- package/dist/functional/result/impl/result-is-result.mjs.map +1 -1
- package/dist/functional/result/impl/result-map-err.d.mts +3 -0
- package/dist/functional/result/impl/result-map-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-map-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-map.d.mts +4 -0
- package/dist/functional/result/impl/result-map.d.mts.map +1 -1
- package/dist/functional/result/impl/result-map.mjs.map +1 -1
- package/dist/functional/result/impl/result-ok.d.mts +4 -2
- package/dist/functional/result/impl/result-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-ok.mjs +3 -1
- package/dist/functional/result/impl/result-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-or-else.d.mts +4 -0
- package/dist/functional/result/impl/result-or-else.d.mts.map +1 -1
- package/dist/functional/result/impl/result-or-else.mjs.map +1 -1
- package/dist/functional/result/impl/result-swap.d.mts +2 -0
- package/dist/functional/result/impl/result-swap.d.mts.map +1 -1
- package/dist/functional/result/impl/result-swap.mjs +2 -0
- package/dist/functional/result/impl/result-swap.mjs.map +1 -1
- package/dist/functional/result/impl/result-to-optional.d.mts +2 -0
- package/dist/functional/result/impl/result-to-optional.d.mts.map +1 -1
- package/dist/functional/result/impl/result-to-optional.mjs +2 -0
- package/dist/functional/result/impl/result-to-optional.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts +7 -4
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +3 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs +3 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.d.mts +3 -2
- package/dist/functional/result/impl/result-unwrap-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.mjs +3 -2
- package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +7 -4
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok.d.mts +3 -2
- package/dist/functional/result/impl/result-unwrap-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.d.mts +3 -1
- package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs +3 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-zip.d.mts +3 -1
- package/dist/functional/result/impl/result-zip.d.mts.map +1 -1
- package/dist/functional/result/impl/result-zip.mjs +3 -1
- package/dist/functional/result/impl/result-zip.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +3 -2
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs +2 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +4 -0
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +3 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +3 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +3 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +3 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +7 -3
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +7 -3
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts +3 -0
- package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts +3 -0
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map.d.mts +6 -0
- package/dist/functional/ternary-result/impl/ternary-result-map.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts +4 -0
- package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +4 -0
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -1
- package/dist/globals.d.mts +12 -1
- package/dist/guard/has-key.d.mts +6 -3
- package/dist/guard/has-key.d.mts.map +1 -1
- package/dist/guard/has-key.mjs +2 -2
- package/dist/guard/index.mjs +1 -1
- package/dist/guard/is-record.d.mts +31 -0
- package/dist/guard/is-record.d.mts.map +1 -1
- package/dist/guard/is-record.mjs +32 -1
- package/dist/guard/is-record.mjs.map +1 -1
- package/dist/guard/is-type.d.mts +3 -0
- package/dist/guard/is-type.d.mts.map +1 -1
- package/dist/guard/is-type.mjs +3 -0
- package/dist/guard/is-type.mjs.map +1 -1
- package/dist/guard/key-is-in.d.mts +3 -2
- package/dist/guard/key-is-in.d.mts.map +1 -1
- package/dist/guard/key-is-in.mjs +3 -2
- package/dist/guard/key-is-in.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/iterator/range.d.mts +4 -0
- package/dist/iterator/range.d.mts.map +1 -1
- package/dist/iterator/range.mjs +1 -0
- package/dist/iterator/range.mjs.map +1 -1
- package/dist/json/json.d.mts +42 -21
- package/dist/json/json.d.mts.map +1 -1
- package/dist/json/json.mjs +42 -21
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/int.d.mts +33 -19
- package/dist/number/branded-types/int.d.mts.map +1 -1
- package/dist/number/branded-types/int.mjs +33 -19
- package/dist/number/branded-types/int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +2 -2
- package/dist/number/branded-types/positive-int.d.mts +34 -20
- package/dist/number/branded-types/positive-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int.mjs +34 -20
- package/dist/number/branded-types/positive-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-safe-int.d.mts +47 -26
- package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-safe-int.mjs +48 -27
- package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-int.d.mts +48 -27
- package/dist/number/branded-types/safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/safe-int.mjs +50 -29
- package/dist/number/branded-types/safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-uint.mjs +1 -1
- package/dist/number/branded-types/uint.d.mts +31 -19
- package/dist/number/branded-types/uint.d.mts.map +1 -1
- package/dist/number/branded-types/uint.mjs +31 -19
- package/dist/number/branded-types/uint.mjs.map +1 -1
- package/dist/number/num.d.mts +29 -20
- package/dist/number/num.d.mts.map +1 -1
- package/dist/number/num.mjs +24 -17
- package/dist/number/num.mjs.map +1 -1
- package/dist/number/refined-number-utils.d.mts +33 -11
- package/dist/number/refined-number-utils.d.mts.map +1 -1
- package/dist/number/refined-number-utils.mjs +33 -11
- package/dist/number/refined-number-utils.mjs.map +1 -1
- package/dist/object/object.d.mts +12 -3
- package/dist/object/object.d.mts.map +1 -1
- package/dist/object/object.mjs +10 -3
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/map-nullable.mjs.map +1 -1
- package/dist/others/tuple.d.mts +14 -3
- package/dist/others/tuple.d.mts.map +1 -1
- package/dist/others/tuple.mjs +14 -3
- package/dist/others/tuple.mjs.map +1 -1
- package/dist/others/unknown-to-string.d.mts.map +1 -1
- package/dist/others/unknown-to-string.mjs.map +1 -1
- package/dist/promise/promise.d.mts +8 -4
- package/dist/promise/promise.d.mts.map +1 -1
- package/dist/promise/promise.mjs +8 -4
- package/dist/promise/promise.mjs.map +1 -1
- package/package.json +26 -28
- package/src/array/impl/array-utils-creation.mts +20 -0
- package/src/array/impl/array-utils-creation.test.mts +72 -1
- package/src/array/impl/array-utils-element-access.mts +13 -0
- package/src/array/impl/array-utils-element-access.test.mts +36 -15
- package/src/array/impl/array-utils-iterators.test.mts +17 -0
- package/src/array/impl/array-utils-modification.mts +78 -19
- package/src/array/impl/array-utils-modification.test.mts +75 -0
- package/src/array/impl/array-utils-overload-type-error.test.mts +19 -0
- package/src/array/impl/array-utils-reducing-value.mts +61 -16
- package/src/array/impl/array-utils-reducing-value.test.mts +107 -25
- package/src/array/impl/array-utils-search.mts +57 -4
- package/src/array/impl/array-utils-search.test.mts +61 -10
- package/src/array/impl/array-utils-set-op.mts +26 -7
- package/src/array/impl/array-utils-set-op.test.mts +129 -13
- package/src/array/impl/array-utils-size.mts +5 -2
- package/src/array/impl/array-utils-size.test.mts +1 -0
- package/src/array/impl/array-utils-slice-clamped.mts +7 -0
- package/src/array/impl/array-utils-slice-clamped.test.mts +20 -0
- package/src/array/impl/array-utils-slicing.mts +29 -2
- package/src/array/impl/array-utils-slicing.test.mts +57 -0
- package/src/array/impl/array-utils-transformation.mts +58 -0
- package/src/array/impl/array-utils-transformation.test.mts +115 -3
- package/src/array/impl/array-utils-validation.mts +41 -18
- package/src/array/impl/array-utils-validation.test.mts +176 -78
- package/src/array/impl/array.test.mts +18 -6
- package/src/collections/imap-mapped.mts +11 -0
- package/src/collections/imap-mapped.test.mts +86 -18
- package/src/collections/imap.mts +47 -15
- package/src/collections/imap.test.mts +137 -31
- package/src/collections/iset-mapped.mts +54 -19
- package/src/collections/iset-mapped.test.mts +163 -52
- package/src/collections/iset.mts +53 -19
- package/src/collections/iset.test.mts +323 -130
- package/src/collections/queue.mts +78 -25
- package/src/collections/queue.test.mts +65 -35
- package/src/collections/stack.mts +67 -25
- package/src/collections/stack.test.mts +59 -15
- package/src/functional/match.mts +17 -1
- package/src/functional/match.test.mts +2 -0
- package/src/functional/optional/impl/optional-expect-to-be.mts +5 -2
- package/src/functional/optional/impl/optional-filter.mts +6 -0
- package/src/functional/optional/impl/optional-flat-map.mts +4 -0
- package/src/functional/optional/impl/optional-from-nullable.mts +2 -0
- package/src/functional/optional/impl/optional-is-none.mts +1 -1
- package/src/functional/optional/impl/optional-is-optional.mts +4 -2
- package/src/functional/optional/impl/optional-is-some.mts +2 -1
- package/src/functional/optional/impl/optional-map.mts +5 -0
- package/src/functional/optional/impl/optional-none.mts +4 -2
- package/src/functional/optional/impl/optional-or-else.mts +6 -0
- package/src/functional/optional/impl/optional-some.mts +5 -3
- package/src/functional/optional/impl/optional-to-nullable.mts +4 -2
- package/src/functional/optional/impl/optional-unwrap-or.mts +9 -4
- package/src/functional/optional/impl/optional-unwrap-throw.mts +2 -1
- package/src/functional/optional/impl/optional-unwrap.mts +4 -2
- package/src/functional/optional/impl/optional-zip.mts +3 -1
- package/src/functional/optional.test.mts +126 -54
- package/src/functional/pipe.mts +2 -2
- package/src/functional/pipe.test.mts +7 -4
- package/src/functional/result/impl/result-err.mts +4 -2
- package/src/functional/result/impl/result-expect-to-be.mts +5 -2
- package/src/functional/result/impl/result-flat-map.mts +7 -0
- package/src/functional/result/impl/result-fold.mts +6 -0
- package/src/functional/result/impl/result-from-promise.mts +4 -1
- package/src/functional/result/impl/result-from-throwable.mts +5 -1
- package/src/functional/result/impl/result-is-err.mts +4 -2
- package/src/functional/result/impl/result-is-ok.mts +4 -2
- package/src/functional/result/impl/result-is-result.mts +7 -3
- package/src/functional/result/impl/result-map-err.mts +5 -0
- package/src/functional/result/impl/result-map.mts +6 -0
- package/src/functional/result/impl/result-ok.mts +4 -2
- package/src/functional/result/impl/result-or-else.mts +6 -0
- package/src/functional/result/impl/result-swap.mts +2 -0
- package/src/functional/result/impl/result-to-optional.mts +2 -0
- package/src/functional/result/impl/result-unwrap-err-or.mts +9 -4
- package/src/functional/result/impl/result-unwrap-err-throw.mts +3 -1
- package/src/functional/result/impl/result-unwrap-err.mts +3 -2
- package/src/functional/result/impl/result-unwrap-ok-or.mts +9 -4
- package/src/functional/result/impl/result-unwrap-ok.mts +4 -2
- package/src/functional/result/impl/result-unwrap-throw.mts +3 -1
- package/src/functional/result/impl/result-zip.mts +3 -1
- package/src/functional/result.test.mts +182 -152
- package/src/functional/ternary-result/impl/ternary-result-err.mts +3 -2
- package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +4 -0
- package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +7 -0
- package/src/functional/ternary-result/impl/ternary-result-fold.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +3 -1
- package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +4 -1
- package/src/functional/ternary-result/impl/ternary-result-is-ok.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +7 -3
- package/src/functional/ternary-result/impl/ternary-result-is-warn.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-map-err.mts +6 -0
- package/src/functional/ternary-result/impl/ternary-result-map-warn.mts +6 -0
- package/src/functional/ternary-result/impl/ternary-result-map.mts +9 -0
- package/src/functional/ternary-result/impl/ternary-result-ok.mts +1 -1
- package/src/functional/ternary-result/impl/ternary-result-or-else.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-to-optional.mts +2 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err.mts +2 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-ok.mts +3 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts +2 -0
- package/src/functional/ternary-result/impl/ternary-result-warn.mts +4 -1
- package/src/functional/ternary-result/impl/ternary-result-zip.mts +4 -0
- package/src/functional/ternary-result.test.mts +99 -8
- package/src/globals.d.mts +12 -1
- package/src/guard/has-key.mts +8 -5
- package/src/guard/has-key.test.mts +9 -5
- package/src/guard/is-error.test.mts +143 -0
- package/src/guard/is-non-empty-string.test.mts +44 -24
- package/src/guard/is-non-null-object.test.mts +45 -26
- package/src/guard/is-primitive.test.mts +51 -28
- package/src/guard/is-record.mts +34 -0
- package/src/guard/is-record.test.mts +28 -7
- package/src/guard/is-type.mts +3 -0
- package/src/guard/is-type.test.mts +285 -155
- package/src/guard/key-is-in.mts +3 -2
- package/src/guard/key-is-in.test.mts +2 -2
- package/src/iterator/range.mts +9 -0
- package/src/json/json.mts +50 -21
- package/src/json/json.test.mts +224 -176
- package/src/number/branded-types/finite-number.test.mts +51 -11
- package/src/number/branded-types/int.mts +33 -19
- package/src/number/branded-types/int.test.mts +56 -14
- package/src/number/branded-types/int16.test.mts +63 -16
- package/src/number/branded-types/int32.test.mts +63 -16
- package/src/number/branded-types/non-negative-finite-number.test.mts +52 -12
- package/src/number/branded-types/non-negative-int16.test.mts +59 -16
- package/src/number/branded-types/non-negative-int32.test.mts +59 -16
- package/src/number/branded-types/non-zero-finite-number.test.mts +65 -14
- package/src/number/branded-types/non-zero-int.test.mts +72 -19
- package/src/number/branded-types/non-zero-int16.test.mts +60 -16
- package/src/number/branded-types/non-zero-int32.test.mts +60 -16
- package/src/number/branded-types/non-zero-safe-int.mts +2 -2
- package/src/number/branded-types/non-zero-safe-int.test.mts +85 -23
- package/src/number/branded-types/non-zero-uint16.test.mts +53 -16
- package/src/number/branded-types/non-zero-uint32.test.mts +53 -16
- package/src/number/branded-types/positive-finite-number.test.mts +59 -14
- package/src/number/branded-types/positive-int.mts +34 -20
- package/src/number/branded-types/positive-int.test.mts +64 -17
- package/src/number/branded-types/positive-int16.test.mts +50 -15
- package/src/number/branded-types/positive-int32.test.mts +50 -15
- package/src/number/branded-types/positive-safe-int.mts +48 -27
- package/src/number/branded-types/positive-safe-int.test.mts +68 -19
- package/src/number/branded-types/positive-uint16.test.mts +53 -16
- package/src/number/branded-types/positive-uint32.test.mts +53 -16
- package/src/number/branded-types/safe-int.mts +50 -29
- package/src/number/branded-types/safe-int.test.mts +70 -18
- package/src/number/branded-types/safe-uint.mts +1 -1
- package/src/number/branded-types/safe-uint.test.mts +65 -17
- package/src/number/branded-types/uint.mts +31 -19
- package/src/number/branded-types/uint.test.mts +58 -15
- package/src/number/branded-types/uint16.test.mts +56 -15
- package/src/number/branded-types/uint32.test.mts +56 -15
- package/src/number/enum/int8.test.mts +7 -1
- package/src/number/enum/uint8.test.mts +7 -1
- package/src/number/num.mts +32 -21
- package/src/number/num.test.mts +88 -26
- package/src/number/refined-number-utils.mts +38 -13
- package/src/object/object.mts +19 -3
- package/src/object/object.test.mts +16 -6
- package/src/others/cast-mutable.test.mts +8 -1
- package/src/others/cast-readonly.test.mts +21 -4
- package/src/others/if-then.test.mts +40 -24
- package/src/others/map-nullable.mts +3 -0
- package/src/others/map-nullable.test.mts +27 -0
- package/src/others/memoize-function.test.mts +41 -0
- package/src/others/tuple.mts +14 -3
- package/src/others/unknown-to-string.mts +2 -0
- package/src/others/unknown-to-string.test.mts +10 -0
- package/src/promise/promise.mts +8 -4
- package/src/promise/promise.test.mts +8 -13
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { ISetMapped } from './iset-mapped.mjs';
|
|
2
2
|
|
|
3
3
|
const toKey = (a: Readonly<{ v: number }>): number => a.v;
|
|
4
|
+
|
|
4
5
|
const fromKey = (k: number): Readonly<{ v: number }> => ({ v: k });
|
|
5
6
|
|
|
6
7
|
// Test types for additional functionality
|
|
7
8
|
type TestElement = { id: number; type: string };
|
|
9
|
+
|
|
8
10
|
const testElementToString = (el: Readonly<TestElement>): string =>
|
|
9
11
|
`${el.type}_${el.id}`;
|
|
12
|
+
|
|
10
13
|
const stringToTestElement = (str: string): TestElement => {
|
|
11
14
|
const [type, idStr] = str.split('_');
|
|
15
|
+
|
|
12
16
|
return { type: type ?? '', id: Number(idStr ?? '0') };
|
|
13
17
|
};
|
|
14
18
|
|
|
@@ -47,7 +51,7 @@ describe('ISetMapped.has', () => {
|
|
|
47
51
|
fromKey,
|
|
48
52
|
);
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
assert.isTrue(s0.has({ v: 3 }));
|
|
51
55
|
});
|
|
52
56
|
|
|
53
57
|
test('case 2', () => {
|
|
@@ -57,7 +61,7 @@ describe('ISetMapped.has', () => {
|
|
|
57
61
|
fromKey,
|
|
58
62
|
);
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
assert.isFalse(s0.has({ v: 4 }));
|
|
61
65
|
});
|
|
62
66
|
|
|
63
67
|
test('case 3', () => {
|
|
@@ -67,7 +71,7 @@ describe('ISetMapped.has', () => {
|
|
|
67
71
|
fromKey,
|
|
68
72
|
);
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
assert.isFalse(s0.has({ v: 3 }));
|
|
71
75
|
});
|
|
72
76
|
});
|
|
73
77
|
|
|
@@ -87,6 +91,7 @@ describe('ISetMapped.add', () => {
|
|
|
87
91
|
fromKey,
|
|
88
92
|
),
|
|
89
93
|
);
|
|
94
|
+
|
|
90
95
|
assert.deepStrictEqual(
|
|
91
96
|
s0,
|
|
92
97
|
ISetMapped.create([{ v: 1 }, { v: 2 }, { v: 3 }], toKey, fromKey),
|
|
@@ -104,6 +109,7 @@ describe('ISetMapped.add', () => {
|
|
|
104
109
|
s0.add({ v: 3 }),
|
|
105
110
|
ISetMapped.create([{ v: 1 }, { v: 2 }, { v: 3 }], toKey, fromKey),
|
|
106
111
|
);
|
|
112
|
+
|
|
107
113
|
assert.deepStrictEqual(
|
|
108
114
|
s0,
|
|
109
115
|
ISetMapped.create([{ v: 1 }, { v: 2 }, { v: 3 }], toKey, fromKey),
|
|
@@ -117,6 +123,7 @@ describe('ISetMapped.add', () => {
|
|
|
117
123
|
s0.add({ v: 1 }),
|
|
118
124
|
ISetMapped.create([{ v: 1 }], toKey, fromKey),
|
|
119
125
|
);
|
|
126
|
+
|
|
120
127
|
assert.deepStrictEqual(s0, ISetMapped.create([], toKey, fromKey));
|
|
121
128
|
});
|
|
122
129
|
});
|
|
@@ -133,6 +140,7 @@ describe('ISetMapped.delete', () => {
|
|
|
133
140
|
s0.delete({ v: 10 }),
|
|
134
141
|
ISetMapped.create([{ v: 1 }, { v: 2 }, { v: 3 }], toKey, fromKey),
|
|
135
142
|
);
|
|
143
|
+
|
|
136
144
|
assert.deepStrictEqual(
|
|
137
145
|
s0,
|
|
138
146
|
ISetMapped.create([{ v: 1 }, { v: 2 }, { v: 3 }], toKey, fromKey),
|
|
@@ -150,6 +158,7 @@ describe('ISetMapped.delete', () => {
|
|
|
150
158
|
s0.delete({ v: 3 }),
|
|
151
159
|
ISetMapped.create([{ v: 1 }, { v: 2 }], toKey, fromKey),
|
|
152
160
|
);
|
|
161
|
+
|
|
153
162
|
assert.deepStrictEqual(
|
|
154
163
|
s0,
|
|
155
164
|
ISetMapped.create([{ v: 1 }, { v: 2 }, { v: 3 }], toKey, fromKey),
|
|
@@ -163,6 +172,7 @@ describe('ISetMapped.delete', () => {
|
|
|
163
172
|
s0.delete({ v: 1 }),
|
|
164
173
|
ISetMapped.create([], toKey, fromKey),
|
|
165
174
|
);
|
|
175
|
+
|
|
166
176
|
assert.deepStrictEqual(s0, ISetMapped.create([], toKey, fromKey));
|
|
167
177
|
});
|
|
168
178
|
});
|
|
@@ -174,6 +184,7 @@ describe('ISetMapped.forEach', () => {
|
|
|
174
184
|
toKey,
|
|
175
185
|
fromKey,
|
|
176
186
|
);
|
|
187
|
+
|
|
177
188
|
const elements = [{ v: 1 }, { v: 2 }, { v: 3 }];
|
|
178
189
|
|
|
179
190
|
for (const el of s0) {
|
|
@@ -189,6 +200,7 @@ describe('ISetMapped.keys', () => {
|
|
|
189
200
|
toKey,
|
|
190
201
|
fromKey,
|
|
191
202
|
);
|
|
203
|
+
|
|
192
204
|
const elements = [{ v: 1 }, { v: 2 }, { v: 3 }];
|
|
193
205
|
|
|
194
206
|
for (const k of s0.keys()) {
|
|
@@ -204,6 +216,7 @@ describe('ISetMapped.values', () => {
|
|
|
204
216
|
toKey,
|
|
205
217
|
fromKey,
|
|
206
218
|
);
|
|
219
|
+
|
|
207
220
|
const elements = [{ v: 1 }, { v: 2 }, { v: 3 }];
|
|
208
221
|
|
|
209
222
|
for (const v of s0.values()) {
|
|
@@ -219,10 +232,12 @@ describe('ISetMapped.entries', () => {
|
|
|
219
232
|
toKey,
|
|
220
233
|
fromKey,
|
|
221
234
|
);
|
|
235
|
+
|
|
222
236
|
const elements = [{ v: 1 }, { v: 2 }, { v: 3 }];
|
|
223
237
|
|
|
224
238
|
for (const [k, v] of s0.entries()) {
|
|
225
239
|
expect(elements).toContainEqual(k);
|
|
240
|
+
|
|
226
241
|
expect(elements).toContainEqual(v);
|
|
227
242
|
|
|
228
243
|
assert.deepStrictEqual(k, v);
|
|
@@ -237,6 +252,7 @@ describe('ISetMapped.subtract', () => {
|
|
|
237
252
|
toKey,
|
|
238
253
|
fromKey,
|
|
239
254
|
);
|
|
255
|
+
|
|
240
256
|
const s1 = ISetMapped.create([{ v: 2 }, { v: 4 }], toKey, fromKey);
|
|
241
257
|
|
|
242
258
|
assert.deepStrictEqual(
|
|
@@ -251,6 +267,7 @@ describe('ISetMapped.subtract', () => {
|
|
|
251
267
|
toKey,
|
|
252
268
|
fromKey,
|
|
253
269
|
);
|
|
270
|
+
|
|
254
271
|
const s1 = ISetMapped.create([], toKey, fromKey);
|
|
255
272
|
|
|
256
273
|
assert.deepStrictEqual(
|
|
@@ -261,6 +278,7 @@ describe('ISetMapped.subtract', () => {
|
|
|
261
278
|
|
|
262
279
|
test('case 3', () => {
|
|
263
280
|
const s0 = ISetMapped.create([], toKey, fromKey);
|
|
281
|
+
|
|
264
282
|
const s1 = ISetMapped.create(
|
|
265
283
|
[{ v: 1 }, { v: 2 }, { v: 3 }],
|
|
266
284
|
toKey,
|
|
@@ -281,6 +299,7 @@ describe('ISetMapped.diff', () => {
|
|
|
281
299
|
toKey,
|
|
282
300
|
fromKey,
|
|
283
301
|
);
|
|
302
|
+
|
|
284
303
|
const s1 = ISetMapped.create(
|
|
285
304
|
[{ v: 2 }, { v: 3 }, { v: 4 }],
|
|
286
305
|
toKey,
|
|
@@ -293,6 +312,7 @@ describe('ISetMapped.diff', () => {
|
|
|
293
312
|
diff.deleted,
|
|
294
313
|
ISetMapped.create([{ v: 1 }], toKey, fromKey),
|
|
295
314
|
);
|
|
315
|
+
|
|
296
316
|
assert.deepStrictEqual(
|
|
297
317
|
diff.added,
|
|
298
318
|
ISetMapped.create([{ v: 4 }], toKey, fromKey),
|
|
@@ -305,6 +325,7 @@ describe('ISetMapped.diff', () => {
|
|
|
305
325
|
toKey,
|
|
306
326
|
fromKey,
|
|
307
327
|
);
|
|
328
|
+
|
|
308
329
|
const s1 = ISetMapped.create([], toKey, fromKey);
|
|
309
330
|
|
|
310
331
|
const diff = ISetMapped.diff(s0, s1);
|
|
@@ -313,11 +334,13 @@ describe('ISetMapped.diff', () => {
|
|
|
313
334
|
diff.deleted,
|
|
314
335
|
ISetMapped.create([{ v: 1 }, { v: 2 }, { v: 3 }], toKey, fromKey),
|
|
315
336
|
);
|
|
337
|
+
|
|
316
338
|
assert.deepStrictEqual(diff.added, ISetMapped.create([], toKey, fromKey));
|
|
317
339
|
});
|
|
318
340
|
|
|
319
341
|
test('case 3', () => {
|
|
320
342
|
const s0 = ISetMapped.create([], toKey, fromKey);
|
|
343
|
+
|
|
321
344
|
const s1 = ISetMapped.create(
|
|
322
345
|
[{ v: 1 }, { v: 2 }, { v: 3 }],
|
|
323
346
|
toKey,
|
|
@@ -327,6 +350,7 @@ describe('ISetMapped.diff', () => {
|
|
|
327
350
|
const diff = ISetMapped.diff(s0, s1);
|
|
328
351
|
|
|
329
352
|
assert.deepStrictEqual(diff.deleted, ISetMapped.create([], toKey, fromKey));
|
|
353
|
+
|
|
330
354
|
assert.deepStrictEqual(
|
|
331
355
|
diff.added,
|
|
332
356
|
ISetMapped.create([{ v: 1 }, { v: 2 }, { v: 3 }], toKey, fromKey),
|
|
@@ -341,6 +365,7 @@ describe('ISetMapped.union', () => {
|
|
|
341
365
|
toKey,
|
|
342
366
|
fromKey,
|
|
343
367
|
);
|
|
368
|
+
|
|
344
369
|
const s1 = ISetMapped.create(
|
|
345
370
|
[{ v: 3 }, { v: 4 }, { v: 5 }],
|
|
346
371
|
toKey,
|
|
@@ -363,6 +388,7 @@ describe('ISetMapped.union', () => {
|
|
|
363
388
|
toKey,
|
|
364
389
|
fromKey,
|
|
365
390
|
);
|
|
391
|
+
|
|
366
392
|
const s1 = ISetMapped.create([], toKey, fromKey);
|
|
367
393
|
|
|
368
394
|
assert.deepStrictEqual(
|
|
@@ -373,6 +399,7 @@ describe('ISetMapped.union', () => {
|
|
|
373
399
|
|
|
374
400
|
test('case 3', () => {
|
|
375
401
|
const s0 = ISetMapped.create([], toKey, fromKey);
|
|
402
|
+
|
|
376
403
|
const s1 = ISetMapped.create(
|
|
377
404
|
[{ v: 1 }, { v: 2 }, { v: 3 }],
|
|
378
405
|
toKey,
|
|
@@ -393,6 +420,7 @@ describe('ISetMapped.intersection', () => {
|
|
|
393
420
|
toKey,
|
|
394
421
|
fromKey,
|
|
395
422
|
);
|
|
423
|
+
|
|
396
424
|
const s1 = ISetMapped.create(
|
|
397
425
|
[{ v: 2 }, { v: 3 }, { v: 4 }],
|
|
398
426
|
toKey,
|
|
@@ -411,6 +439,7 @@ describe('ISetMapped.intersection', () => {
|
|
|
411
439
|
toKey,
|
|
412
440
|
fromKey,
|
|
413
441
|
);
|
|
442
|
+
|
|
414
443
|
const s1 = ISetMapped.create([], toKey, fromKey);
|
|
415
444
|
|
|
416
445
|
assert.deepStrictEqual(
|
|
@@ -421,6 +450,7 @@ describe('ISetMapped.intersection', () => {
|
|
|
421
450
|
|
|
422
451
|
test('case 3', () => {
|
|
423
452
|
const s0 = ISetMapped.create([], toKey, fromKey);
|
|
453
|
+
|
|
424
454
|
const s1 = ISetMapped.create(
|
|
425
455
|
[{ v: 1 }, { v: 2 }, { v: 3 }],
|
|
426
456
|
toKey,
|
|
@@ -457,8 +487,10 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
457
487
|
);
|
|
458
488
|
|
|
459
489
|
expect(set.size).toBe(2);
|
|
460
|
-
|
|
461
|
-
|
|
490
|
+
|
|
491
|
+
assert.isTrue(set.has({ id: 1, type: 'user' }));
|
|
492
|
+
|
|
493
|
+
assert.isTrue(set.has({ id: 2, type: 'admin' }));
|
|
462
494
|
});
|
|
463
495
|
|
|
464
496
|
test('should handle duplicate elements based on mapping', () => {
|
|
@@ -486,6 +518,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
486
518
|
testElementToString,
|
|
487
519
|
stringToTestElement,
|
|
488
520
|
);
|
|
521
|
+
|
|
489
522
|
const set2 = ISetMapped.create(
|
|
490
523
|
[
|
|
491
524
|
{ id: 2, type: 'admin' },
|
|
@@ -495,7 +528,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
495
528
|
stringToTestElement,
|
|
496
529
|
);
|
|
497
530
|
|
|
498
|
-
|
|
531
|
+
assert.isTrue(ISetMapped.equal(set1, set2));
|
|
499
532
|
});
|
|
500
533
|
|
|
501
534
|
test('should return false for sets with different elements', () => {
|
|
@@ -507,6 +540,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
507
540
|
testElementToString,
|
|
508
541
|
stringToTestElement,
|
|
509
542
|
);
|
|
543
|
+
|
|
510
544
|
const set2 = ISetMapped.create(
|
|
511
545
|
[
|
|
512
546
|
{ id: 1, type: 'user' },
|
|
@@ -516,7 +550,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
516
550
|
stringToTestElement,
|
|
517
551
|
);
|
|
518
552
|
|
|
519
|
-
|
|
553
|
+
assert.isFalse(ISetMapped.equal(set1, set2));
|
|
520
554
|
});
|
|
521
555
|
|
|
522
556
|
test('should return true for empty sets', () => {
|
|
@@ -525,13 +559,14 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
525
559
|
testElementToString,
|
|
526
560
|
stringToTestElement,
|
|
527
561
|
);
|
|
562
|
+
|
|
528
563
|
const set2 = ISetMapped.create<TestElement, string>(
|
|
529
564
|
[],
|
|
530
565
|
testElementToString,
|
|
531
566
|
stringToTestElement,
|
|
532
567
|
);
|
|
533
568
|
|
|
534
|
-
|
|
569
|
+
assert.isTrue(ISetMapped.equal(set1, set2));
|
|
535
570
|
});
|
|
536
571
|
});
|
|
537
572
|
|
|
@@ -546,6 +581,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
546
581
|
testElementToString,
|
|
547
582
|
stringToTestElement,
|
|
548
583
|
);
|
|
584
|
+
|
|
549
585
|
const newSet = ISetMapped.create(
|
|
550
586
|
[
|
|
551
587
|
{ id: 2, type: 'admin' },
|
|
@@ -559,10 +595,12 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
559
595
|
const diff = ISetMapped.diff(oldSet, newSet);
|
|
560
596
|
|
|
561
597
|
expect(diff.deleted.size).toBe(1);
|
|
562
|
-
|
|
598
|
+
|
|
599
|
+
assert.isTrue(diff.deleted.has({ id: 1, type: 'user' }));
|
|
563
600
|
|
|
564
601
|
expect(diff.added.size).toBe(1);
|
|
565
|
-
|
|
602
|
+
|
|
603
|
+
assert.isTrue(diff.added.has({ id: 4, type: 'user' }));
|
|
566
604
|
});
|
|
567
605
|
|
|
568
606
|
test('should handle no changes', () => {
|
|
@@ -574,6 +612,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
574
612
|
testElementToString,
|
|
575
613
|
stringToTestElement,
|
|
576
614
|
);
|
|
615
|
+
|
|
577
616
|
const set2 = ISetMapped.create(
|
|
578
617
|
[
|
|
579
618
|
{ id: 1, type: 'user' },
|
|
@@ -586,6 +625,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
586
625
|
const diff = ISetMapped.diff(set1, set2);
|
|
587
626
|
|
|
588
627
|
expect(diff.deleted.size).toBe(0);
|
|
628
|
+
|
|
589
629
|
expect(diff.added.size).toBe(0);
|
|
590
630
|
});
|
|
591
631
|
});
|
|
@@ -601,6 +641,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
601
641
|
testElementToString,
|
|
602
642
|
stringToTestElement,
|
|
603
643
|
);
|
|
644
|
+
|
|
604
645
|
const set2 = ISetMapped.create(
|
|
605
646
|
[
|
|
606
647
|
{ id: 2, type: 'admin' },
|
|
@@ -614,8 +655,10 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
614
655
|
const intersection = ISetMapped.intersection(set1, set2);
|
|
615
656
|
|
|
616
657
|
expect(intersection.size).toBe(2);
|
|
617
|
-
|
|
618
|
-
|
|
658
|
+
|
|
659
|
+
assert.isTrue(intersection.has({ id: 2, type: 'admin' }));
|
|
660
|
+
|
|
661
|
+
assert.isTrue(intersection.has({ id: 3, type: 'guest' }));
|
|
619
662
|
});
|
|
620
663
|
|
|
621
664
|
test('should compute union correctly', () => {
|
|
@@ -627,6 +670,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
627
670
|
testElementToString,
|
|
628
671
|
stringToTestElement,
|
|
629
672
|
);
|
|
673
|
+
|
|
630
674
|
const set2 = ISetMapped.create(
|
|
631
675
|
[
|
|
632
676
|
{ id: 3, type: 'guest' },
|
|
@@ -639,10 +683,14 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
639
683
|
const union = ISetMapped.union(set1, set2);
|
|
640
684
|
|
|
641
685
|
expect(union.size).toBe(4);
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
686
|
+
|
|
687
|
+
assert.isTrue(union.has({ id: 1, type: 'user' }));
|
|
688
|
+
|
|
689
|
+
assert.isTrue(union.has({ id: 2, type: 'admin' }));
|
|
690
|
+
|
|
691
|
+
assert.isTrue(union.has({ id: 3, type: 'guest' }));
|
|
692
|
+
|
|
693
|
+
assert.isTrue(union.has({ id: 4, type: 'user' }));
|
|
646
694
|
});
|
|
647
695
|
});
|
|
648
696
|
|
|
@@ -657,7 +705,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
657
705
|
stringToTestElement,
|
|
658
706
|
);
|
|
659
707
|
|
|
660
|
-
|
|
708
|
+
assert.isTrue(set.every((el) => el.type === 'user'));
|
|
661
709
|
});
|
|
662
710
|
|
|
663
711
|
test('should return false when some elements do not satisfy predicate', () => {
|
|
@@ -670,7 +718,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
670
718
|
stringToTestElement,
|
|
671
719
|
);
|
|
672
720
|
|
|
673
|
-
|
|
721
|
+
assert.isFalse(set.every((el) => el.type === 'user'));
|
|
674
722
|
});
|
|
675
723
|
});
|
|
676
724
|
|
|
@@ -685,7 +733,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
685
733
|
stringToTestElement,
|
|
686
734
|
);
|
|
687
735
|
|
|
688
|
-
|
|
736
|
+
assert.isTrue(set.some((el) => el.type === 'admin'));
|
|
689
737
|
});
|
|
690
738
|
|
|
691
739
|
test('should return false when no elements satisfy predicate', () => {
|
|
@@ -698,7 +746,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
698
746
|
stringToTestElement,
|
|
699
747
|
);
|
|
700
748
|
|
|
701
|
-
|
|
749
|
+
assert.isFalse(set.some((el) => el.type === 'admin'));
|
|
702
750
|
});
|
|
703
751
|
});
|
|
704
752
|
|
|
@@ -709,11 +757,14 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
709
757
|
testElementToString,
|
|
710
758
|
stringToTestElement,
|
|
711
759
|
);
|
|
760
|
+
|
|
712
761
|
const updated = set.add({ id: 2, type: 'admin' });
|
|
713
762
|
|
|
714
763
|
expect(updated.size).toBe(2);
|
|
715
|
-
|
|
716
|
-
|
|
764
|
+
|
|
765
|
+
assert.isTrue(updated.has({ id: 1, type: 'user' }));
|
|
766
|
+
|
|
767
|
+
assert.isTrue(updated.has({ id: 2, type: 'admin' }));
|
|
717
768
|
});
|
|
718
769
|
|
|
719
770
|
test('should return same instance when adding existing element', () => {
|
|
@@ -722,6 +773,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
722
773
|
testElementToString,
|
|
723
774
|
stringToTestElement,
|
|
724
775
|
);
|
|
776
|
+
|
|
725
777
|
const updated = set.add({ id: 1, type: 'user' });
|
|
726
778
|
|
|
727
779
|
expect(updated).toBe(set);
|
|
@@ -738,11 +790,14 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
738
790
|
testElementToString,
|
|
739
791
|
stringToTestElement,
|
|
740
792
|
);
|
|
793
|
+
|
|
741
794
|
const updated = set.delete({ id: 1, type: 'user' });
|
|
742
795
|
|
|
743
796
|
expect(updated.size).toBe(1);
|
|
744
|
-
|
|
745
|
-
|
|
797
|
+
|
|
798
|
+
assert.isFalse(updated.has({ id: 1, type: 'user' }));
|
|
799
|
+
|
|
800
|
+
assert.isTrue(updated.has({ id: 2, type: 'admin' }));
|
|
746
801
|
});
|
|
747
802
|
|
|
748
803
|
test('should return same instance when deleting non-existent element', () => {
|
|
@@ -751,6 +806,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
751
806
|
testElementToString,
|
|
752
807
|
stringToTestElement,
|
|
753
808
|
);
|
|
809
|
+
|
|
754
810
|
const updated = set.delete({ id: 2, type: 'admin' });
|
|
755
811
|
|
|
756
812
|
expect(updated).toBe(set);
|
|
@@ -772,9 +828,12 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
772
828
|
]);
|
|
773
829
|
|
|
774
830
|
expect(updated.size).toBe(2);
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
831
|
+
|
|
832
|
+
assert.isFalse(updated.has({ id: 1, type: 'user' }));
|
|
833
|
+
|
|
834
|
+
assert.isTrue(updated.has({ id: 2, type: 'admin' }));
|
|
835
|
+
|
|
836
|
+
assert.isTrue(updated.has({ id: 3, type: 'guest' }));
|
|
778
837
|
});
|
|
779
838
|
|
|
780
839
|
test('should handle empty mutations array', () => {
|
|
@@ -783,10 +842,12 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
783
842
|
testElementToString,
|
|
784
843
|
stringToTestElement,
|
|
785
844
|
);
|
|
845
|
+
|
|
786
846
|
const updated = set.withMutations([]);
|
|
787
847
|
|
|
788
848
|
expect(updated.size).toBe(1);
|
|
789
|
-
|
|
849
|
+
|
|
850
|
+
assert.isTrue(ISetMapped.equal(set, updated));
|
|
790
851
|
});
|
|
791
852
|
});
|
|
792
853
|
|
|
@@ -800,14 +861,17 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
800
861
|
testElementToString,
|
|
801
862
|
stringToTestElement,
|
|
802
863
|
);
|
|
864
|
+
|
|
803
865
|
const transformed = set.map((el) => ({
|
|
804
866
|
...el,
|
|
805
867
|
type: el.type.toUpperCase(),
|
|
806
868
|
}));
|
|
807
869
|
|
|
808
870
|
expect(transformed.size).toBe(2);
|
|
809
|
-
|
|
810
|
-
|
|
871
|
+
|
|
872
|
+
assert.isTrue(transformed.has({ id: 1, type: 'USER' }));
|
|
873
|
+
|
|
874
|
+
assert.isTrue(transformed.has({ id: 2, type: 'ADMIN' }));
|
|
811
875
|
});
|
|
812
876
|
});
|
|
813
877
|
|
|
@@ -822,12 +886,16 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
822
886
|
testElementToString,
|
|
823
887
|
stringToTestElement,
|
|
824
888
|
);
|
|
889
|
+
|
|
825
890
|
const filtered = set.filter((el) => el.type === 'user');
|
|
826
891
|
|
|
827
892
|
expect(filtered.size).toBe(2);
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
893
|
+
|
|
894
|
+
assert.isTrue(filtered.has({ id: 1, type: 'user' }));
|
|
895
|
+
|
|
896
|
+
assert.isTrue(filtered.has({ id: 3, type: 'user' }));
|
|
897
|
+
|
|
898
|
+
assert.isFalse(filtered.has({ id: 2, type: 'admin' }));
|
|
831
899
|
});
|
|
832
900
|
});
|
|
833
901
|
|
|
@@ -842,12 +910,16 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
842
910
|
testElementToString,
|
|
843
911
|
stringToTestElement,
|
|
844
912
|
);
|
|
913
|
+
|
|
845
914
|
const filtered = set.filterNot((el) => el.type === 'user');
|
|
846
915
|
|
|
847
916
|
expect(filtered.size).toBe(1);
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
917
|
+
|
|
918
|
+
assert.isTrue(filtered.has({ id: 2, type: 'admin' }));
|
|
919
|
+
|
|
920
|
+
assert.isFalse(filtered.has({ id: 1, type: 'user' }));
|
|
921
|
+
|
|
922
|
+
assert.isFalse(filtered.has({ id: 3, type: 'user' }));
|
|
851
923
|
});
|
|
852
924
|
});
|
|
853
925
|
|
|
@@ -861,6 +933,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
861
933
|
testElementToString,
|
|
862
934
|
stringToTestElement,
|
|
863
935
|
);
|
|
936
|
+
|
|
864
937
|
const mut_collected: TestElement[] = [];
|
|
865
938
|
|
|
866
939
|
for (const el of set) {
|
|
@@ -868,7 +941,9 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
868
941
|
}
|
|
869
942
|
|
|
870
943
|
expect(mut_collected).toHaveLength(2);
|
|
944
|
+
|
|
871
945
|
expect(mut_collected).toContainEqual({ id: 1, type: 'user' });
|
|
946
|
+
|
|
872
947
|
expect(mut_collected).toContainEqual({ id: 2, type: 'admin' });
|
|
873
948
|
});
|
|
874
949
|
});
|
|
@@ -880,6 +955,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
880
955
|
testElementToString,
|
|
881
956
|
stringToTestElement,
|
|
882
957
|
);
|
|
958
|
+
|
|
883
959
|
const superset = ISetMapped.create(
|
|
884
960
|
[
|
|
885
961
|
{ id: 1, type: 'user' },
|
|
@@ -889,7 +965,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
889
965
|
stringToTestElement,
|
|
890
966
|
);
|
|
891
967
|
|
|
892
|
-
|
|
968
|
+
assert.isTrue(subset.isSubsetOf(superset));
|
|
893
969
|
});
|
|
894
970
|
|
|
895
971
|
test('should return false for non-subset', () => {
|
|
@@ -901,6 +977,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
901
977
|
testElementToString,
|
|
902
978
|
stringToTestElement,
|
|
903
979
|
);
|
|
980
|
+
|
|
904
981
|
const set2 = ISetMapped.create(
|
|
905
982
|
[
|
|
906
983
|
{ id: 1, type: 'user' },
|
|
@@ -910,7 +987,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
910
987
|
stringToTestElement,
|
|
911
988
|
);
|
|
912
989
|
|
|
913
|
-
|
|
990
|
+
assert.isFalse(set1.isSubsetOf(set2));
|
|
914
991
|
});
|
|
915
992
|
});
|
|
916
993
|
|
|
@@ -924,13 +1001,14 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
924
1001
|
testElementToString,
|
|
925
1002
|
stringToTestElement,
|
|
926
1003
|
);
|
|
1004
|
+
|
|
927
1005
|
const subset = ISetMapped.create(
|
|
928
1006
|
[{ id: 1, type: 'user' }],
|
|
929
1007
|
testElementToString,
|
|
930
1008
|
stringToTestElement,
|
|
931
1009
|
);
|
|
932
1010
|
|
|
933
|
-
|
|
1011
|
+
assert.isTrue(superset.isSupersetOf(subset));
|
|
934
1012
|
});
|
|
935
1013
|
|
|
936
1014
|
test('should return false for non-superset', () => {
|
|
@@ -942,6 +1020,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
942
1020
|
testElementToString,
|
|
943
1021
|
stringToTestElement,
|
|
944
1022
|
);
|
|
1023
|
+
|
|
945
1024
|
const set2 = ISetMapped.create(
|
|
946
1025
|
[
|
|
947
1026
|
{ id: 1, type: 'user' },
|
|
@@ -951,7 +1030,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
951
1030
|
stringToTestElement,
|
|
952
1031
|
);
|
|
953
1032
|
|
|
954
|
-
|
|
1033
|
+
assert.isFalse(set1.isSupersetOf(set2));
|
|
955
1034
|
});
|
|
956
1035
|
});
|
|
957
1036
|
|
|
@@ -966,6 +1045,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
966
1045
|
testElementToString,
|
|
967
1046
|
stringToTestElement,
|
|
968
1047
|
);
|
|
1048
|
+
|
|
969
1049
|
const set2 = ISetMapped.create(
|
|
970
1050
|
[
|
|
971
1051
|
{ id: 2, type: 'admin' },
|
|
@@ -974,12 +1054,16 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
974
1054
|
testElementToString,
|
|
975
1055
|
stringToTestElement,
|
|
976
1056
|
);
|
|
1057
|
+
|
|
977
1058
|
const result = set1.subtract(set2);
|
|
978
1059
|
|
|
979
1060
|
expect(result.size).toBe(2);
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1061
|
+
|
|
1062
|
+
assert.isTrue(result.has({ id: 1, type: 'user' }));
|
|
1063
|
+
|
|
1064
|
+
assert.isTrue(result.has({ id: 3, type: 'guest' }));
|
|
1065
|
+
|
|
1066
|
+
assert.isFalse(result.has({ id: 2, type: 'admin' }));
|
|
983
1067
|
});
|
|
984
1068
|
});
|
|
985
1069
|
|
|
@@ -994,6 +1078,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
994
1078
|
testElementToString,
|
|
995
1079
|
stringToTestElement,
|
|
996
1080
|
);
|
|
1081
|
+
|
|
997
1082
|
const set2 = ISetMapped.create(
|
|
998
1083
|
[
|
|
999
1084
|
{ id: 2, type: 'admin' },
|
|
@@ -1003,12 +1088,16 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1003
1088
|
testElementToString,
|
|
1004
1089
|
stringToTestElement,
|
|
1005
1090
|
);
|
|
1091
|
+
|
|
1006
1092
|
const result = set1.intersect(set2);
|
|
1007
1093
|
|
|
1008
1094
|
expect(result.size).toBe(2);
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1095
|
+
|
|
1096
|
+
assert.isTrue(result.has({ id: 2, type: 'admin' }));
|
|
1097
|
+
|
|
1098
|
+
assert.isTrue(result.has({ id: 3, type: 'guest' }));
|
|
1099
|
+
|
|
1100
|
+
assert.isFalse(result.has({ id: 1, type: 'user' }));
|
|
1012
1101
|
});
|
|
1013
1102
|
});
|
|
1014
1103
|
|
|
@@ -1022,6 +1111,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1022
1111
|
testElementToString,
|
|
1023
1112
|
stringToTestElement,
|
|
1024
1113
|
);
|
|
1114
|
+
|
|
1025
1115
|
const set2 = ISetMapped.create(
|
|
1026
1116
|
[
|
|
1027
1117
|
{ id: 3, type: 'guest' },
|
|
@@ -1030,13 +1120,18 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1030
1120
|
testElementToString,
|
|
1031
1121
|
stringToTestElement,
|
|
1032
1122
|
);
|
|
1123
|
+
|
|
1033
1124
|
const result = set1.union(set2);
|
|
1034
1125
|
|
|
1035
1126
|
expect(result.size).toBe(4);
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1127
|
+
|
|
1128
|
+
assert.isTrue(result.has({ id: 1, type: 'user' }));
|
|
1129
|
+
|
|
1130
|
+
assert.isTrue(result.has({ id: 2, type: 'admin' }));
|
|
1131
|
+
|
|
1132
|
+
assert.isTrue(result.has({ id: 3, type: 'guest' }));
|
|
1133
|
+
|
|
1134
|
+
assert.isTrue(result.has({ id: 4, type: 'user' }));
|
|
1040
1135
|
});
|
|
1041
1136
|
});
|
|
1042
1137
|
|
|
@@ -1050,10 +1145,13 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1050
1145
|
testElementToString,
|
|
1051
1146
|
stringToTestElement,
|
|
1052
1147
|
);
|
|
1148
|
+
|
|
1053
1149
|
const keys = Array.from(set.keys());
|
|
1054
1150
|
|
|
1055
1151
|
expect(keys).toHaveLength(2);
|
|
1152
|
+
|
|
1056
1153
|
expect(keys).toContainEqual({ id: 1, type: 'user' });
|
|
1154
|
+
|
|
1057
1155
|
expect(keys).toContainEqual({ id: 2, type: 'admin' });
|
|
1058
1156
|
});
|
|
1059
1157
|
|
|
@@ -1066,10 +1164,13 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1066
1164
|
testElementToString,
|
|
1067
1165
|
stringToTestElement,
|
|
1068
1166
|
);
|
|
1167
|
+
|
|
1069
1168
|
const values = Array.from(set.values());
|
|
1070
1169
|
|
|
1071
1170
|
expect(values).toHaveLength(2);
|
|
1171
|
+
|
|
1072
1172
|
expect(values).toContainEqual({ id: 1, type: 'user' });
|
|
1173
|
+
|
|
1073
1174
|
expect(values).toContainEqual({ id: 2, type: 'admin' });
|
|
1074
1175
|
});
|
|
1075
1176
|
|
|
@@ -1082,6 +1183,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1082
1183
|
testElementToString,
|
|
1083
1184
|
stringToTestElement,
|
|
1084
1185
|
);
|
|
1186
|
+
|
|
1085
1187
|
const entries = Array.from(set.entries());
|
|
1086
1188
|
|
|
1087
1189
|
expect(entries).toHaveLength(2);
|
|
@@ -1100,6 +1202,7 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1100
1202
|
testElementToString,
|
|
1101
1203
|
stringToTestElement,
|
|
1102
1204
|
);
|
|
1205
|
+
|
|
1103
1206
|
const mut_collected: TestElement[] = [];
|
|
1104
1207
|
|
|
1105
1208
|
for (const element of set) {
|
|
@@ -1107,7 +1210,9 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1107
1210
|
}
|
|
1108
1211
|
|
|
1109
1212
|
expect(mut_collected).toHaveLength(2);
|
|
1213
|
+
|
|
1110
1214
|
expect(mut_collected).toContainEqual({ id: 1, type: 'user' });
|
|
1215
|
+
|
|
1111
1216
|
expect(mut_collected).toContainEqual({ id: 2, type: 'admin' });
|
|
1112
1217
|
});
|
|
1113
1218
|
});
|
|
@@ -1122,10 +1227,13 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1122
1227
|
testElementToString,
|
|
1123
1228
|
stringToTestElement,
|
|
1124
1229
|
);
|
|
1230
|
+
|
|
1125
1231
|
const array = set.toArray();
|
|
1126
1232
|
|
|
1127
1233
|
expect(array).toHaveLength(2);
|
|
1234
|
+
|
|
1128
1235
|
expect(array).toContainEqual({ id: 1, type: 'user' });
|
|
1236
|
+
|
|
1129
1237
|
expect(array).toContainEqual({ id: 2, type: 'admin' });
|
|
1130
1238
|
});
|
|
1131
1239
|
|
|
@@ -1138,11 +1246,14 @@ describe('ISetMapped additional functionality with complex types', () => {
|
|
|
1138
1246
|
testElementToString,
|
|
1139
1247
|
stringToTestElement,
|
|
1140
1248
|
);
|
|
1249
|
+
|
|
1141
1250
|
const rawSet = set.toRawSet();
|
|
1142
1251
|
|
|
1143
1252
|
expect(rawSet.size).toBe(2);
|
|
1144
|
-
|
|
1145
|
-
|
|
1253
|
+
|
|
1254
|
+
assert.isTrue(rawSet.has('user_1'));
|
|
1255
|
+
|
|
1256
|
+
assert.isTrue(rawSet.has('admin_2'));
|
|
1146
1257
|
});
|
|
1147
1258
|
});
|
|
1148
1259
|
});
|