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
|
@@ -14,13 +14,16 @@ type UnwrapPromise<P extends Promise<unknown>> = P extends Promise<infer V> ? V
|
|
|
14
14
|
*
|
|
15
15
|
* ```ts
|
|
16
16
|
* const successPromise = Result.fromPromise(Promise.resolve('ok'));
|
|
17
|
+
*
|
|
17
18
|
* const failurePromise = Result.fromPromise(Promise.reject(new Error('fail')));
|
|
18
19
|
*
|
|
19
20
|
* const resolved = await successPromise;
|
|
21
|
+
*
|
|
20
22
|
* const rejected = await failurePromise;
|
|
21
23
|
*
|
|
22
24
|
* assert.deepStrictEqual(resolved, Result.ok('ok'));
|
|
23
|
-
*
|
|
25
|
+
*
|
|
26
|
+
* assert.isTrue(Result.isErr(rejected));
|
|
24
27
|
* ```
|
|
25
28
|
*
|
|
26
29
|
* @template P The type of the input Promise.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-from-promise.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-from-promise.mts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,KAAK,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,IAC3C,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEzC
|
|
1
|
+
{"version":3,"file":"result-from-promise.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-from-promise.mts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,KAAK,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,IAC3C,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,EACpD,SAAS,CAAC,KACT,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAEmB,CAAC"}
|
|
@@ -11,13 +11,16 @@ import { ok } from './result-ok.mjs';
|
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
13
|
* const successPromise = Result.fromPromise(Promise.resolve('ok'));
|
|
14
|
+
*
|
|
14
15
|
* const failurePromise = Result.fromPromise(Promise.reject(new Error('fail')));
|
|
15
16
|
*
|
|
16
17
|
* const resolved = await successPromise;
|
|
18
|
+
*
|
|
17
19
|
* const rejected = await failurePromise;
|
|
18
20
|
*
|
|
19
21
|
* assert.deepStrictEqual(resolved, Result.ok('ok'));
|
|
20
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* assert.isTrue(Result.isErr(rejected));
|
|
21
24
|
* ```
|
|
22
25
|
*
|
|
23
26
|
* @template P The type of the input Promise.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-from-promise.mjs","sources":["../../../../src/functional/result/impl/result-from-promise.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAWA
|
|
1
|
+
{"version":3,"file":"result-from-promise.mjs","sources":["../../../../src/functional/result/impl/result-from-promise.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACI,MAAM,WAAW,GAAG,CACzB,OAAU;AAEV;AACA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAyB,CAAC,CAAC,KAAK,CAAC,GAAG;;;;"}
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
*
|
|
13
13
|
* ```ts
|
|
14
14
|
* const success = Result.fromThrowable(() => 1 + 1);
|
|
15
|
+
*
|
|
15
16
|
* const failure = Result.fromThrowable(() => {
|
|
16
17
|
* throw new Error('boom');
|
|
17
18
|
* });
|
|
18
19
|
*
|
|
19
20
|
* assert.deepStrictEqual(success, Result.ok(2));
|
|
20
|
-
*
|
|
21
|
+
*
|
|
22
|
+
* assert.isTrue(Result.isErr(failure));
|
|
21
23
|
* ```
|
|
22
24
|
*
|
|
23
25
|
* @template T The return type of the function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-from-throwable.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-from-throwable.mts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"result-from-throwable.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-from-throwable.mts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAG,IAAI,MAAM,CAAC,KAAG,MAAM,CAAC,CAAC,EAAE,KAAK,CAY9D,CAAC"}
|
|
@@ -17,12 +17,14 @@ import { ok } from './result-ok.mjs';
|
|
|
17
17
|
*
|
|
18
18
|
* ```ts
|
|
19
19
|
* const success = Result.fromThrowable(() => 1 + 1);
|
|
20
|
+
*
|
|
20
21
|
* const failure = Result.fromThrowable(() => {
|
|
21
22
|
* throw new Error('boom');
|
|
22
23
|
* });
|
|
23
24
|
*
|
|
24
25
|
* assert.deepStrictEqual(success, Result.ok(2));
|
|
25
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* assert.isTrue(Result.isErr(failure));
|
|
26
28
|
* ```
|
|
27
29
|
*
|
|
28
30
|
* @template T The return type of the function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-from-throwable.mjs","sources":["../../../../src/functional/result/impl/result-from-throwable.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA
|
|
1
|
+
{"version":3,"file":"result-from-throwable.mjs","sources":["../../../../src/functional/result/impl/result-from-throwable.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,aAAa,GAAG,CAAK,EAAW,KAAsB;AACjE,IAAA,IAAI;AACF,QAAA,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;IACjB;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;AAClB,YAAA,OAAO,GAAG,CAAC,KAAK,CAAC;QACnB;AAEA,QAAA,MAAM,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC;QAElC,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B;AACF;;;;"}
|
|
@@ -6,14 +6,16 @@ import { type NarrowToErr } from './types.mjs';
|
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
8
|
* const operation = Result.ok(3);
|
|
9
|
+
*
|
|
9
10
|
* const failure = Result.err('error');
|
|
10
11
|
*
|
|
11
12
|
* if (Result.isOk(operation)) {
|
|
12
13
|
* const value: number = operation.value;
|
|
13
|
-
*
|
|
14
|
+
*
|
|
15
|
+
* assert.isTrue(value === 3);
|
|
14
16
|
* }
|
|
15
17
|
*
|
|
16
|
-
* assert.
|
|
18
|
+
* assert.isTrue(Result.isErr(failure));
|
|
17
19
|
* ```
|
|
18
20
|
*/
|
|
19
21
|
export declare const isErr: <R extends UnknownResult>(result: R) => result is NarrowToErr<R>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-is-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-is-err.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"result-is-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-is-err.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,aAAa,EAC3C,QAAQ,CAAC,KACR,MAAM,IAAI,WAAW,CAAC,CAAC,CAAoC,CAAC"}
|
|
@@ -7,14 +7,16 @@ import { ErrTypeTagName } from './tag.mjs';
|
|
|
7
7
|
*
|
|
8
8
|
* ```ts
|
|
9
9
|
* const operation = Result.ok(3);
|
|
10
|
+
*
|
|
10
11
|
* const failure = Result.err('error');
|
|
11
12
|
*
|
|
12
13
|
* if (Result.isOk(operation)) {
|
|
13
14
|
* const value: number = operation.value;
|
|
14
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* assert.isTrue(value === 3);
|
|
15
17
|
* }
|
|
16
18
|
*
|
|
17
|
-
* assert.
|
|
19
|
+
* assert.isTrue(Result.isErr(failure));
|
|
18
20
|
* ```
|
|
19
21
|
*/
|
|
20
22
|
const isErr = (result) => result.$$tag === ErrTypeTagName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-is-err.mjs","sources":["../../../../src/functional/result/impl/result-is-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"result-is-err.mjs","sources":["../../../../src/functional/result/impl/result-is-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,KAAK,GAAG,CACnB,MAAS,KACoB,MAAM,CAAC,KAAK,KAAK;;;;"}
|
|
@@ -6,14 +6,16 @@ import { type NarrowToOk } from './types.mjs';
|
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
8
|
* const operation = Result.ok(3);
|
|
9
|
+
*
|
|
9
10
|
* const failure = Result.err('error');
|
|
10
11
|
*
|
|
11
12
|
* if (Result.isOk(operation)) {
|
|
12
13
|
* const value: number = operation.value;
|
|
13
|
-
*
|
|
14
|
+
*
|
|
15
|
+
* assert.isTrue(value === 3);
|
|
14
16
|
* }
|
|
15
17
|
*
|
|
16
|
-
* assert.
|
|
18
|
+
* assert.isTrue(Result.isErr(failure));
|
|
17
19
|
* ```
|
|
18
20
|
*/
|
|
19
21
|
export declare const isOk: <R extends UnknownResult>(result: R) => result is NarrowToOk<R>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-is-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-is-ok.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"result-is-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-is-ok.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,aAAa,EAC1C,QAAQ,CAAC,KACR,MAAM,IAAI,UAAU,CAAC,CAAC,CAAmC,CAAC"}
|
|
@@ -7,14 +7,16 @@ import { OkTypeTagName } from './tag.mjs';
|
|
|
7
7
|
*
|
|
8
8
|
* ```ts
|
|
9
9
|
* const operation = Result.ok(3);
|
|
10
|
+
*
|
|
10
11
|
* const failure = Result.err('error');
|
|
11
12
|
*
|
|
12
13
|
* if (Result.isOk(operation)) {
|
|
13
14
|
* const value: number = operation.value;
|
|
14
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* assert.isTrue(value === 3);
|
|
15
17
|
* }
|
|
16
18
|
*
|
|
17
|
-
* assert.
|
|
19
|
+
* assert.isTrue(Result.isErr(failure));
|
|
18
20
|
* ```
|
|
19
21
|
*/
|
|
20
22
|
const isOk = (result) => result.$$tag === OkTypeTagName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-is-ok.mjs","sources":["../../../../src/functional/result/impl/result-is-ok.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"result-is-ok.mjs","sources":["../../../../src/functional/result/impl/result-is-ok.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,IAAI,GAAG,CAClB,MAAS,KACmB,MAAM,CAAC,KAAK,KAAK;;;;"}
|
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
*
|
|
6
6
|
* ```ts
|
|
7
7
|
* const okValue = Result.ok('success');
|
|
8
|
+
*
|
|
8
9
|
* const errValue = Result.err(new Error('failure'));
|
|
10
|
+
*
|
|
9
11
|
* const notResult = { $$tag: 'ts-data-forge::Result.ok' };
|
|
10
12
|
*
|
|
11
|
-
* assert.
|
|
12
|
-
*
|
|
13
|
-
* assert.
|
|
13
|
+
* assert.isTrue(Result.isResult(okValue));
|
|
14
|
+
*
|
|
15
|
+
* assert.isTrue(Result.isResult(errValue));
|
|
16
|
+
*
|
|
17
|
+
* assert.isFalse(Result.isResult(notResult));
|
|
14
18
|
* ```
|
|
15
19
|
*/
|
|
16
20
|
export declare const isResult: (maybeResult: unknown) => maybeResult is UnknownResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-is-result.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-is-result.mts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"result-is-result.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-is-result.mts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ,GAAI,aAAa,OAAO,KAAG,WAAW,IAAI,aAIgB,CAAC"}
|
|
@@ -9,12 +9,16 @@ import { ErrTypeTagName, OkTypeTagName } from './tag.mjs';
|
|
|
9
9
|
*
|
|
10
10
|
* ```ts
|
|
11
11
|
* const okValue = Result.ok('success');
|
|
12
|
+
*
|
|
12
13
|
* const errValue = Result.err(new Error('failure'));
|
|
14
|
+
*
|
|
13
15
|
* const notResult = { $$tag: 'ts-data-forge::Result.ok' };
|
|
14
16
|
*
|
|
15
|
-
* assert.
|
|
16
|
-
*
|
|
17
|
-
* assert.
|
|
17
|
+
* assert.isTrue(Result.isResult(okValue));
|
|
18
|
+
*
|
|
19
|
+
* assert.isTrue(Result.isResult(errValue));
|
|
20
|
+
*
|
|
21
|
+
* assert.isFalse(Result.isResult(notResult));
|
|
18
22
|
* ```
|
|
19
23
|
*/
|
|
20
24
|
const isResult = (maybeResult) => isRecord(maybeResult) &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-is-result.mjs","sources":["../../../../src/functional/result/impl/result-is-result.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAGA
|
|
1
|
+
{"version":3,"file":"result-is-result.mjs","sources":["../../../../src/functional/result/impl/result-is-result.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAGA;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,QAAQ,GAAG,CAAC,WAAoB,KAC3C,QAAQ,CAAC,WAAW,CAAC;AACrB,IAAA,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;AAC5B,IAAA,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;AAC5B,KAAC,WAAW,CAAC,KAAK,KAAK,cAAc,IAAI,WAAW,CAAC,KAAK,KAAK,aAAa;;;;"}
|
|
@@ -7,12 +7,15 @@ import { type UnwrapErr, type UnwrapOk } from './types.mjs';
|
|
|
7
7
|
*
|
|
8
8
|
* ```ts
|
|
9
9
|
* const okValue = Result.ok(3) as Result<number, string>;
|
|
10
|
+
*
|
|
10
11
|
* const errValue = Result.err('missing');
|
|
11
12
|
*
|
|
12
13
|
* const untouchedOk = Result.mapErr(okValue, (error) => error.toUpperCase());
|
|
14
|
+
*
|
|
13
15
|
* const uppercasedErr = Result.mapErr(errValue, (error) => error.toUpperCase());
|
|
14
16
|
*
|
|
15
17
|
* assert.deepStrictEqual(untouchedOk, Result.ok(3));
|
|
18
|
+
*
|
|
16
19
|
* assert.deepStrictEqual(uppercasedErr, Result.err('MISSING'));
|
|
17
20
|
*
|
|
18
21
|
* const mapError = Result.mapErr((error: Readonly<Error>) => error.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-map-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-map-err.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"result-map-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-map-err.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,aAAa,EAAE,EAAE,EAChD,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,GACjC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAG3B,wBAAgB,MAAM,CAAC,CAAC,EAAE,EAAE,EAC1B,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GACtB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-map-err.mjs","sources":["../../../../src/functional/result/impl/result-map-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"result-map-err.mjs","sources":["../../../../src/functional/result/impl/result-map-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AA8CM,SAAU,MAAM,CACpB,GAAG,IAE8C,EAAA;AAEjD,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI;AAE5B,YAAA,OAAO,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC;QAClC;QAEA,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;YAEpB,OAAO,CAAC,MAAS,KAAK,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC;QACjD;;AAEJ;AAEA,MAAM,UAAU,GAAG,CACjB,MAAS,EACT,KAAkC,KAElC,IAAI,CAAC,MAAM;AACT;QACG;AACH;QACE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC;;;;"}
|
|
@@ -8,17 +8,21 @@ import { type UnwrapErr, type UnwrapOk } from './types.mjs';
|
|
|
8
8
|
*
|
|
9
9
|
* ```ts
|
|
10
10
|
* const okNumber = Result.ok(5);
|
|
11
|
+
*
|
|
11
12
|
* const errMessage = Result.err('error');
|
|
12
13
|
*
|
|
13
14
|
* const doubled = Result.map(okNumber, (value) => value * 2);
|
|
15
|
+
*
|
|
14
16
|
* const untouchedError = Result.map(errMessage, (value: number) => value * 2);
|
|
15
17
|
*
|
|
16
18
|
* assert.deepStrictEqual(doubled, Result.ok(10));
|
|
19
|
+
*
|
|
17
20
|
* assert.deepStrictEqual(untouchedError, errMessage);
|
|
18
21
|
*
|
|
19
22
|
* const mapToLength = Result.map((text: string) => text.length);
|
|
20
23
|
*
|
|
21
24
|
* assert.deepStrictEqual(mapToLength(Result.ok('abc')), Result.ok(3));
|
|
25
|
+
*
|
|
22
26
|
* assert.deepStrictEqual(mapToLength(Result.err('bad')), Result.err('bad'));
|
|
23
27
|
* ```
|
|
24
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-map.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-map.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"result-map.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-map.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,aAAa,EAAE,EAAE,EAC7C,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,GAChC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAG5B,wBAAgB,GAAG,CAAC,CAAC,EAAE,EAAE,EACvB,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GACtB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-map.mjs","sources":["../../../../src/functional/result/impl/result-map.mts"],"sourcesContent":[null],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"result-map.mjs","sources":["../../../../src/functional/result/impl/result-map.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAgDM,SAAU,GAAG,CACjB,GAAG,IAE6C,EAAA;AAEhD,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI;AAE5B,YAAA,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC;QAC/B;QAEA,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;YAEpB,OAAO,CAAC,MAAS,KAAK,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC;QAC9C;;AAEJ;AAEA,MAAM,OAAO,GAAG,CACd,MAAS,EACT,KAAiC,KAEjC,KAAK,CAAC,MAAM;AACV;QACG;AACH;QACE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAoB,CAAC,CAAC;;;;"}
|
|
@@ -8,18 +8,20 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ```ts
|
|
10
10
|
* const success = Result.ok({ id: 1 });
|
|
11
|
+
*
|
|
11
12
|
* const failure = Result.err(new Error('missing data'));
|
|
12
13
|
*
|
|
13
14
|
* assert.deepStrictEqual(success, {
|
|
14
15
|
* $$tag: 'ts-data-forge::Result.ok',
|
|
15
16
|
* value: { id: 1 },
|
|
16
17
|
* });
|
|
17
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* assert.isTrue(Result.isErr(failure));
|
|
18
20
|
* ```
|
|
19
21
|
*
|
|
20
22
|
* @template S The type of the success value.
|
|
21
23
|
* @param value The success value.
|
|
22
24
|
* @returns A `Result.Ok<S>` containing the value.
|
|
23
25
|
*/
|
|
24
|
-
export declare const ok: <S>(value: S) => Ok<S>;
|
|
26
|
+
export declare const ok: <const S>(value: S) => Ok<S>;
|
|
25
27
|
//# sourceMappingURL=result-ok.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-ok.mts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"result-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-ok.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,EAAE,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,EAAE,CAAC,CAAC,CAG1C,CAAC"}
|
|
@@ -10,13 +10,15 @@ import { OkTypeTagName } from './tag.mjs';
|
|
|
10
10
|
*
|
|
11
11
|
* ```ts
|
|
12
12
|
* const success = Result.ok({ id: 1 });
|
|
13
|
+
*
|
|
13
14
|
* const failure = Result.err(new Error('missing data'));
|
|
14
15
|
*
|
|
15
16
|
* assert.deepStrictEqual(success, {
|
|
16
17
|
* $$tag: 'ts-data-forge::Result.ok',
|
|
17
18
|
* value: { id: 1 },
|
|
18
19
|
* });
|
|
19
|
-
*
|
|
20
|
+
*
|
|
21
|
+
* assert.isTrue(Result.isErr(failure));
|
|
20
22
|
* ```
|
|
21
23
|
*
|
|
22
24
|
* @template S The type of the success value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-ok.mjs","sources":["../../../../src/functional/result/impl/result-ok.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA
|
|
1
|
+
{"version":3,"file":"result-ok.mjs","sources":["../../../../src/functional/result/impl/result-ok.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MACU,EAAE,GAAG,CAAW,KAAQ,MAAa;AAChD,IAAA,KAAK,EAAE,aAAa;IACpB,KAAK;AACN,CAAA;;;;"}
|
|
@@ -6,10 +6,13 @@ import { type NarrowToOk } from './types.mjs';
|
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
8
|
* const primary = Result.ok('primary');
|
|
9
|
+
*
|
|
9
10
|
* const fallback = Result.ok('fallback');
|
|
11
|
+
*
|
|
10
12
|
* const failure = Result.err('failure');
|
|
11
13
|
*
|
|
12
14
|
* assert.deepStrictEqual(Result.orElse(primary, fallback), primary);
|
|
15
|
+
*
|
|
13
16
|
* assert.deepStrictEqual(Result.orElse(failure, fallback), fallback);
|
|
14
17
|
*
|
|
15
18
|
* const orElseFallback = Result.orElse(Result.ok('default'));
|
|
@@ -18,6 +21,7 @@ import { type NarrowToOk } from './types.mjs';
|
|
|
18
21
|
* orElseFallback(Result.err('missing')),
|
|
19
22
|
* Result.ok('default'),
|
|
20
23
|
* );
|
|
24
|
+
*
|
|
21
25
|
* assert.deepStrictEqual(orElseFallback(Result.ok('value')), Result.ok('value'));
|
|
22
26
|
* ```
|
|
23
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"result-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,aAAa,EAAE,EAAE,SAAS,aAAa,EACtE,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,EAAE,GACd,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAGtB,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EACjC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAC1B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-or-else.mjs","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"result-or-else.mjs","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"sourcesContent":[null],"names":[],"mappings":";;AA6CM,SAAU,MAAM,CACpB,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI;AAElC,YAAA,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC;QACxC;QAEA,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI;YAE1B,OAAO,CAAC,MAAS,KAAK,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC;QACvD;;AAEJ;AAEA,MAAM,UAAU,GAAG,CACjB,MAAS,EACT,WAAe,MACS,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,WAAW,CAAC;;;;"}
|
|
@@ -6,9 +6,11 @@ import { type UnwrapErr, type UnwrapOk } from './types.mjs';
|
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
8
|
* const okValue = Result.ok('value');
|
|
9
|
+
*
|
|
9
10
|
* const errValue = Result.err('error');
|
|
10
11
|
*
|
|
11
12
|
* assert.deepStrictEqual(Result.swap(okValue), Result.err('value'));
|
|
13
|
+
*
|
|
12
14
|
* assert.deepStrictEqual(Result.swap(errValue), Result.ok('error'));
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-swap.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-swap.mts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"result-swap.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-swap.mts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,aAAa,EAC1C,QAAQ,CAAC,KACR,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAEsC,CAAC"}
|
|
@@ -10,9 +10,11 @@ import { unwrapOk } from './result-unwrap-ok.mjs';
|
|
|
10
10
|
*
|
|
11
11
|
* ```ts
|
|
12
12
|
* const okValue = Result.ok('value');
|
|
13
|
+
*
|
|
13
14
|
* const errValue = Result.err('error');
|
|
14
15
|
*
|
|
15
16
|
* assert.deepStrictEqual(Result.swap(okValue), Result.err('value'));
|
|
17
|
+
*
|
|
16
18
|
* assert.deepStrictEqual(Result.swap(errValue), Result.ok('error'));
|
|
17
19
|
* ```
|
|
18
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-swap.mjs","sources":["../../../../src/functional/result/impl/result-swap.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAMA
|
|
1
|
+
{"version":3,"file":"result-swap.mjs","sources":["../../../../src/functional/result/impl/result-swap.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAMA;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,IAAI,GAAG,CAClB,MAAS;AAET;AACA,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAqB;;;;"}
|
|
@@ -13,9 +13,11 @@ import { type UnwrapOk } from './types.mjs';
|
|
|
13
13
|
*
|
|
14
14
|
* ```ts
|
|
15
15
|
* const okValue = Result.ok(7);
|
|
16
|
+
*
|
|
16
17
|
* const errValue = Result.err('fail');
|
|
17
18
|
*
|
|
18
19
|
* assert.deepStrictEqual(Result.toOptional(okValue), Optional.some(7));
|
|
20
|
+
*
|
|
19
21
|
* assert.deepStrictEqual(Result.toOptional(errValue), Optional.none);
|
|
20
22
|
* ```
|
|
21
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-to-optional.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-to-optional.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"result-to-optional.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-to-optional.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,aAAa,EAChD,QAAQ,CAAC,KACR,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CACyC,CAAC"}
|
|
@@ -17,9 +17,11 @@ import { unwrapOk } from './result-unwrap-ok.mjs';
|
|
|
17
17
|
*
|
|
18
18
|
* ```ts
|
|
19
19
|
* const okValue = Result.ok(7);
|
|
20
|
+
*
|
|
20
21
|
* const errValue = Result.err('fail');
|
|
21
22
|
*
|
|
22
23
|
* assert.deepStrictEqual(Result.toOptional(okValue), Optional.some(7));
|
|
24
|
+
*
|
|
23
25
|
* assert.deepStrictEqual(Result.toOptional(errValue), Optional.none);
|
|
24
26
|
* ```
|
|
25
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-to-optional.mjs","sources":["../../../../src/functional/result/impl/result-to-optional.mts"],"sourcesContent":[null],"names":["Optional.some","Optional.none"],"mappings":";;;;;AAKA
|
|
1
|
+
{"version":3,"file":"result-to-optional.mjs","sources":["../../../../src/functional/result/impl/result-to-optional.mts"],"sourcesContent":[null],"names":["Optional.some","Optional.none"],"mappings":";;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACI,MAAM,UAAU,GAAG,CACxB,MAAS,KAET,IAAI,CAAC,MAAM,CAAC,GAAGA,IAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAGC;;;;"}
|
|
@@ -7,15 +7,18 @@ import { type UnwrapErr } from './types.mjs';
|
|
|
7
7
|
*
|
|
8
8
|
* ```ts
|
|
9
9
|
* const okResult = Result.ok('success');
|
|
10
|
+
*
|
|
10
11
|
* const errResult = Result.err('failure');
|
|
11
12
|
*
|
|
12
|
-
* assert(Result.unwrapErrOr(okResult, 'default') === 'default');
|
|
13
|
-
*
|
|
13
|
+
* assert.isTrue(Result.unwrapErrOr(okResult, 'default') === 'default');
|
|
14
|
+
*
|
|
15
|
+
* assert.isTrue(Result.unwrapErrOr(errResult, 'default') === 'failure');
|
|
14
16
|
*
|
|
15
17
|
* const unwrapError = Result.unwrapErrOr('fallback error');
|
|
16
18
|
*
|
|
17
|
-
* assert(unwrapError(Result.err('boom')) === 'boom');
|
|
18
|
-
*
|
|
19
|
+
* assert.isTrue(unwrapError(Result.err('boom')) === 'boom');
|
|
20
|
+
*
|
|
21
|
+
* assert.isTrue(unwrapError(Result.ok('no error')) === 'fallback error');
|
|
19
22
|
* ```
|
|
20
23
|
*
|
|
21
24
|
* @template R The `UnknownResult` type to unwrap.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-err-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"result-unwrap-err-or.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,EACpD,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAGpB,wBAAgB,WAAW,CAAC,CAAC,EAC3B,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-err-or.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"result-unwrap-err-or.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAyCM,SAAU,WAAW,CACzB,GAAG,IAAwE,EAAA;AAE3E,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;AAEnC,YAAA,OAAO,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC;QAC9C;QAEA,KAAK,CAAC,EAAE;;AAEN,YAAA,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI;YAE3B,OAAO,CAAC,MAAS,KAAK,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC;QAC7D;;AAEJ;AAEA,MAAM,eAAe,GAAG,CACtB,MAAS,EACT,YAAe,KACM,SAAS,CAAC,MAAM,CAAC,IAAI,YAAY;;;;"}
|
|
@@ -11,9 +11,11 @@ import { type UnwrapErr, type UnwrapOk } from './types.mjs';
|
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
13
|
* const errResult = Result.err(new Error('broken'));
|
|
14
|
+
*
|
|
14
15
|
* const okResult = Result.ok('value');
|
|
15
16
|
*
|
|
16
|
-
* assert(Result.unwrapErrThrow(errResult).message === 'broken');
|
|
17
|
+
* assert.isTrue(Result.unwrapErrThrow(errResult).message === 'broken');
|
|
18
|
+
*
|
|
17
19
|
* assert.throws(() => Result.unwrapErrThrow(okResult), /Expected Err/u);
|
|
18
20
|
* ```
|
|
19
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-err-throw.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-throw.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"result-unwrap-err-throw.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-throw.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,aAAa,EACpD,QAAQ,CAAC,EACT,QAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAwB,KAClD,SAAS,CAAC,CAAC,CAiBb,CAAC"}
|
|
@@ -14,9 +14,11 @@ import { isErr } from './result-is-err.mjs';
|
|
|
14
14
|
*
|
|
15
15
|
* ```ts
|
|
16
16
|
* const errResult = Result.err(new Error('broken'));
|
|
17
|
+
*
|
|
17
18
|
* const okResult = Result.ok('value');
|
|
18
19
|
*
|
|
19
|
-
* assert(Result.unwrapErrThrow(errResult).message === 'broken');
|
|
20
|
+
* assert.isTrue(Result.unwrapErrThrow(errResult).message === 'broken');
|
|
21
|
+
*
|
|
20
22
|
* assert.throws(() => Result.unwrapErrThrow(okResult), /Expected Err/u);
|
|
21
23
|
* ```
|
|
22
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-err-throw.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err-throw.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA
|
|
1
|
+
{"version":3,"file":"result-unwrap-err-throw.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err-throw.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,cAAc,GAAG,CAC5B,MAAS,EACT,KAAA,GAAoC,eAAe,KACnC;AAChB,IAAA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;;QAEjB,OAAO,MAAM,CAAC,KAAqB;IACrC;AAEA,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE;AAClC,QAAA,0BAA0B,EAAE,IAAI;AAChC,QAAA,2BAA2B,EAAE,KAAK;AACnC,KAAA,CAAC;AAEF,IAAA,MAAM,IAAI,KAAK,CACb,CAAA,qBAAA,EAAwB,OAAO,KAAK,KAAK;;AAEvC,IAAA,MAAM,CAAC,KAAoB,CAC5B,CAAA,CAAE,CACJ;AACH;;;;"}
|
|
@@ -11,16 +11,17 @@ import { type UnwrapErr } from './types.mjs';
|
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
13
|
* const okResult = Result.ok('data');
|
|
14
|
+
*
|
|
14
15
|
* const errResult = Result.err('problem');
|
|
15
16
|
*
|
|
16
17
|
* // Result.unwrapErr returns undefined for Ok results
|
|
17
18
|
*
|
|
18
19
|
* // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
19
|
-
* assert(Result.unwrapErr(okResult) === undefined);
|
|
20
|
+
* assert.isTrue(Result.unwrapErr(okResult) === undefined);
|
|
20
21
|
*
|
|
21
22
|
* // Result.unwrapErr returns the error value for Err results
|
|
22
23
|
*
|
|
23
|
-
* assert(Result.unwrapErr(errResult) === 'problem');
|
|
24
|
+
* assert.isTrue(Result.unwrapErr(errResult) === 'problem');
|
|
24
25
|
* ```
|
|
25
26
|
*
|
|
26
27
|
* @template R The `UnknownResult` type to unwrap.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"result-unwrap-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,aAAa,EAC/C,QAAQ,CAAC,KACR,SAAS,CAAC,CAAC,CAAC,GAAG,SAE0C,CAAC"}
|
|
@@ -12,16 +12,17 @@ import { isErr } from './result-is-err.mjs';
|
|
|
12
12
|
*
|
|
13
13
|
* ```ts
|
|
14
14
|
* const okResult = Result.ok('data');
|
|
15
|
+
*
|
|
15
16
|
* const errResult = Result.err('problem');
|
|
16
17
|
*
|
|
17
18
|
* // Result.unwrapErr returns undefined for Ok results
|
|
18
19
|
*
|
|
19
20
|
* // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
20
|
-
* assert(Result.unwrapErr(okResult) === undefined);
|
|
21
|
+
* assert.isTrue(Result.unwrapErr(okResult) === undefined);
|
|
21
22
|
*
|
|
22
23
|
* // Result.unwrapErr returns the error value for Err results
|
|
23
24
|
*
|
|
24
|
-
* assert(Result.unwrapErr(errResult) === 'problem');
|
|
25
|
+
* assert.isTrue(Result.unwrapErr(errResult) === 'problem');
|
|
25
26
|
* ```
|
|
26
27
|
*
|
|
27
28
|
* @template R The `UnknownResult` type to unwrap.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-err.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"result-unwrap-err.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,SAAS,GAAG,CACvB,MAAS;AAET;AACA,KAAK,CAAC,MAAM,CAAC,GAAI,MAAM,CAAC,KAAsB,GAAG;;;;"}
|