ts-data-forge 3.3.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array/impl/array-utils-element-access.d.mts +3 -4
- package/dist/array/impl/array-utils-element-access.d.mts.map +1 -1
- package/dist/array/impl/array-utils-element-access.mjs +8 -8
- package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.d.mts +8 -9
- package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs +9 -7
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.d.mts +0 -1
- package/dist/array/impl/array-utils-search.d.mts.map +1 -1
- package/dist/array/impl/array-utils-search.mjs +6 -6
- package/dist/array/impl/array-utils-search.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +2 -4
- package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
- package/dist/collections/imap-mapped.d.mts +0 -1
- package/dist/collections/imap-mapped.d.mts.map +1 -1
- package/dist/collections/imap-mapped.mjs +7 -6
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.d.mts +0 -1
- package/dist/collections/imap.d.mts.map +1 -1
- package/dist/collections/imap.mjs +11 -9
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/queue.d.mts +0 -1
- package/dist/collections/queue.d.mts.map +1 -1
- package/dist/collections/queue.mjs +4 -4
- package/dist/collections/queue.mjs.map +1 -1
- package/dist/collections/stack.d.mts +0 -1
- package/dist/collections/stack.d.mts.map +1 -1
- package/dist/collections/stack.mjs +4 -4
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/entry-point.d.mts +1 -0
- package/dist/entry-point.d.mts.map +1 -1
- package/dist/entry-point.mjs +6 -4
- package/dist/entry-point.mjs.map +1 -1
- package/dist/functional/index.d.mts +2 -2
- package/dist/functional/index.d.mts.map +1 -1
- package/dist/functional/index.mjs +4 -2
- package/dist/functional/index.mjs.map +1 -1
- package/dist/functional/optional/impl/index.d.mts +18 -0
- package/dist/functional/optional/impl/index.d.mts.map +1 -0
- package/dist/functional/optional/impl/index.mjs +17 -0
- package/dist/functional/optional/impl/index.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts +29 -0
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-expect-to-be.mjs +25 -0
- package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-filter.d.mts +29 -0
- package/dist/functional/optional/impl/optional-filter.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-filter.mjs +28 -0
- package/dist/functional/optional/impl/optional-filter.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-flat-map.d.mts +33 -0
- package/dist/functional/optional/impl/optional-flat-map.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-flat-map.mjs +21 -0
- package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-from-nullable.d.mts +24 -0
- package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-from-nullable.mjs +29 -0
- package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-is-none.d.mts +22 -0
- package/dist/functional/optional/impl/optional-is-none.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-is-none.mjs +25 -0
- package/dist/functional/optional/impl/optional-is-none.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-is-optional.d.mts +18 -0
- package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-is-optional.mjs +27 -0
- package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-is-some.d.mts +22 -0
- package/dist/functional/optional/impl/optional-is-some.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-is-some.mjs +25 -0
- package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-map.d.mts +31 -0
- package/dist/functional/optional/impl/optional-map.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-map.mjs +25 -0
- package/dist/functional/optional/impl/optional-map.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-none.d.mts +16 -0
- package/dist/functional/optional/impl/optional-none.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-none.mjs +20 -0
- package/dist/functional/optional/impl/optional-none.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-or-else.d.mts +35 -0
- package/dist/functional/optional/impl/optional-or-else.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-or-else.mjs +19 -0
- package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-some.d.mts +19 -0
- package/dist/functional/optional/impl/optional-some.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-some.mjs +26 -0
- package/dist/functional/optional/impl/optional-some.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-to-nullable.d.mts +27 -0
- package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-to-nullable.mjs +31 -0
- package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts +33 -0
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-unwrap-or.mjs +19 -0
- package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +29 -0
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs +38 -0
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-unwrap.d.mts +28 -0
- package/dist/functional/optional/impl/optional-unwrap.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-unwrap.mjs +11 -0
- package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -0
- package/dist/functional/optional/impl/optional-zip.d.mts +31 -0
- package/dist/functional/optional/impl/optional-zip.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-zip.mjs +39 -0
- package/dist/functional/optional/impl/optional-zip.mjs.map +1 -0
- package/dist/functional/optional/impl/tag.d.mts +5 -0
- package/dist/functional/optional/impl/tag.d.mts.map +1 -0
- package/dist/functional/optional/impl/tag.mjs +7 -0
- package/dist/functional/optional/impl/tag.mjs.map +1 -0
- package/dist/functional/optional/impl/types.d.mts +22 -0
- package/dist/functional/optional/impl/types.d.mts.map +1 -0
- package/dist/functional/optional/impl/types.mjs +2 -0
- package/dist/functional/optional/impl/types.mjs.map +1 -0
- package/dist/functional/optional/index.d.mts +2 -0
- package/dist/functional/optional/index.d.mts.map +1 -0
- package/dist/functional/optional/index.mjs +3 -0
- package/dist/functional/optional/index.mjs.map +1 -0
- package/dist/functional/pipe.d.mts +4 -4
- package/dist/functional/pipe.d.mts.map +1 -1
- package/dist/functional/pipe.mjs +4 -3
- package/dist/functional/pipe.mjs.map +1 -1
- package/dist/functional/result/impl/index.d.mts +24 -0
- package/dist/functional/result/impl/index.d.mts.map +1 -0
- package/dist/functional/result/impl/index.mjs +23 -0
- package/dist/functional/result/impl/index.mjs.map +1 -0
- package/dist/functional/result/impl/result-err.d.mts +25 -0
- package/dist/functional/result/impl/result-err.d.mts.map +1 -0
- package/dist/functional/result/impl/result-err.mjs +32 -0
- package/dist/functional/result/impl/result-err.mjs.map +1 -0
- package/dist/functional/result/impl/result-expect-to-be.d.mts +27 -0
- package/dist/functional/result/impl/result-expect-to-be.d.mts.map +1 -0
- package/dist/functional/result/impl/result-expect-to-be.mjs +26 -0
- package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -0
- package/dist/functional/result/impl/result-flat-map.d.mts +39 -0
- package/dist/functional/result/impl/result-flat-map.d.mts.map +1 -0
- package/dist/functional/result/impl/result-flat-map.mjs +24 -0
- package/dist/functional/result/impl/result-flat-map.mjs.map +1 -0
- package/dist/functional/result/impl/result-fold.d.mts +45 -0
- package/dist/functional/result/impl/result-fold.d.mts.map +1 -0
- package/dist/functional/result/impl/result-fold.mjs +26 -0
- package/dist/functional/result/impl/result-fold.mjs.map +1 -0
- package/dist/functional/result/impl/result-from-promise.d.mts +32 -0
- package/dist/functional/result/impl/result-from-promise.d.mts.map +1 -0
- package/dist/functional/result/impl/result-from-promise.mjs +32 -0
- package/dist/functional/result/impl/result-from-promise.mjs.map +1 -0
- package/dist/functional/result/impl/result-from-throwable.d.mts +29 -0
- package/dist/functional/result/impl/result-from-throwable.d.mts.map +1 -0
- package/dist/functional/result/impl/result-from-throwable.mjs +46 -0
- package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -0
- package/dist/functional/result/impl/result-is-err.d.mts +20 -0
- package/dist/functional/result/impl/result-is-err.d.mts.map +1 -0
- package/dist/functional/result/impl/result-is-err.mjs +23 -0
- package/dist/functional/result/impl/result-is-err.mjs.map +1 -0
- package/dist/functional/result/impl/result-is-ok.d.mts +20 -0
- package/dist/functional/result/impl/result-is-ok.d.mts.map +1 -0
- package/dist/functional/result/impl/result-is-ok.mjs +23 -0
- package/dist/functional/result/impl/result-is-ok.mjs.map +1 -0
- package/dist/functional/result/impl/result-is-result.d.mts +17 -0
- package/dist/functional/result/impl/result-is-result.d.mts.map +1 -0
- package/dist/functional/result/impl/result-is-result.mjs +26 -0
- package/dist/functional/result/impl/result-is-result.mjs.map +1 -0
- package/dist/functional/result/impl/result-map-err.d.mts +33 -0
- package/dist/functional/result/impl/result-map-err.d.mts.map +1 -0
- package/dist/functional/result/impl/result-map-err.mjs +25 -0
- package/dist/functional/result/impl/result-map-err.mjs.map +1 -0
- package/dist/functional/result/impl/result-map.d.mts +34 -0
- package/dist/functional/result/impl/result-map.d.mts.map +1 -0
- package/dist/functional/result/impl/result-map.mjs +25 -0
- package/dist/functional/result/impl/result-map.mjs.map +1 -0
- package/dist/functional/result/impl/result-ok.d.mts +25 -0
- package/dist/functional/result/impl/result-ok.d.mts.map +1 -0
- package/dist/functional/result/impl/result-ok.mjs +32 -0
- package/dist/functional/result/impl/result-ok.mjs.map +1 -0
- package/dist/functional/result/impl/result-or-else.d.mts +32 -0
- package/dist/functional/result/impl/result-or-else.d.mts.map +1 -0
- package/dist/functional/result/impl/result-or-else.mjs +20 -0
- package/dist/functional/result/impl/result-or-else.mjs.map +1 -0
- package/dist/functional/result/impl/result-swap.d.mts +20 -0
- package/dist/functional/result/impl/result-swap.d.mts.map +1 -0
- package/dist/functional/result/impl/result-swap.mjs +28 -0
- package/dist/functional/result/impl/result-swap.mjs.map +1 -0
- package/dist/functional/result/impl/result-to-optional.d.mts +28 -0
- package/dist/functional/result/impl/result-to-optional.d.mts.map +1 -0
- package/dist/functional/result/impl/result-to-optional.mjs +34 -0
- package/dist/functional/result/impl/result-to-optional.mjs.map +1 -0
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts +29 -0
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +1 -0
- package/dist/functional/result/impl/result-unwrap-err-or.mjs +20 -0
- package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -0
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +30 -0
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +1 -0
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs +47 -0
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -0
- package/dist/functional/result/impl/result-unwrap-err.d.mts +31 -0
- package/dist/functional/result/impl/result-unwrap-err.d.mts.map +1 -0
- package/dist/functional/result/impl/result-unwrap-err.mjs +36 -0
- package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -0
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +29 -0
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +1 -0
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs +20 -0
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -0
- package/dist/functional/result/impl/result-unwrap-ok.d.mts +23 -0
- package/dist/functional/result/impl/result-unwrap-ok.d.mts.map +1 -0
- package/dist/functional/result/impl/result-unwrap-ok.mjs +11 -0
- package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -0
- package/dist/functional/result/impl/result-unwrap-throw.d.mts +30 -0
- package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +1 -0
- package/dist/functional/result/impl/result-unwrap-throw.mjs +41 -0
- package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -0
- package/dist/functional/result/impl/result-zip.d.mts +29 -0
- package/dist/functional/result/impl/result-zip.d.mts.map +1 -0
- package/dist/functional/result/impl/result-zip.mjs +38 -0
- package/dist/functional/result/impl/result-zip.mjs.map +1 -0
- package/dist/functional/result/impl/tag.d.mts +5 -0
- package/dist/functional/result/impl/tag.d.mts.map +1 -0
- package/dist/functional/result/impl/tag.mjs +7 -0
- package/dist/functional/result/impl/tag.mjs.map +1 -0
- package/dist/functional/result/impl/types.d.mts +29 -0
- package/dist/functional/result/impl/types.d.mts.map +1 -0
- package/dist/functional/result/impl/types.mjs +2 -0
- package/dist/functional/result/impl/types.mjs.map +1 -0
- package/dist/functional/result/index.d.mts +2 -0
- package/dist/functional/result/index.d.mts.map +1 -0
- package/dist/functional/result/index.mjs +3 -0
- package/dist/functional/result/index.mjs.map +1 -0
- package/dist/globals.d.mts +83 -0
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +0 -4
- package/dist/index.mjs.map +1 -1
- package/dist/json/json.d.mts +0 -1
- package/dist/json/json.d.mts.map +1 -1
- package/dist/json/json.mjs +8 -8
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/finite-number.mjs +1 -1
- package/dist/number/branded-types/finite-number.mjs.map +1 -1
- package/dist/number/branded-types/int.mjs +1 -1
- package/dist/number/branded-types/int.mjs.map +1 -1
- package/dist/number/branded-types/int16.mjs +1 -1
- package/dist/number/branded-types/int16.mjs.map +1 -1
- package/dist/number/branded-types/int32.mjs +1 -1
- package/dist/number/branded-types/int32.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-finite-number.mjs +1 -1
- package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int16.mjs +1 -1
- package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int32.mjs +1 -1
- package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-finite-number.mjs +1 -1
- package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int.mjs +1 -1
- package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int16.mjs +1 -1
- package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int32.mjs +1 -1
- package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.mjs +1 -1
- package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.mjs +1 -1
- package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
- package/dist/number/branded-types/positive-finite-number.mjs +1 -1
- package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/positive-int.mjs +1 -1
- package/dist/number/branded-types/positive-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-int16.mjs +1 -1
- package/dist/number/branded-types/positive-int16.mjs.map +1 -1
- package/dist/number/branded-types/positive-int32.mjs +1 -1
- package/dist/number/branded-types/positive-int32.mjs.map +1 -1
- package/dist/number/branded-types/positive-safe-int.mjs +1 -1
- package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint16.mjs +1 -1
- package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint32.mjs +1 -1
- package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
- package/dist/number/branded-types/safe-int.mjs +1 -1
- 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/safe-uint.mjs.map +1 -1
- package/dist/number/branded-types/uint.mjs +1 -1
- package/dist/number/branded-types/uint.mjs.map +1 -1
- package/dist/number/branded-types/uint16.mjs +1 -1
- package/dist/number/branded-types/uint16.mjs.map +1 -1
- package/dist/number/branded-types/uint32.mjs +1 -1
- package/dist/number/branded-types/uint32.mjs.map +1 -1
- package/dist/number/enum/int8.mjs +1 -1
- package/dist/number/enum/int8.mjs.map +1 -1
- package/dist/number/enum/uint8.mjs +1 -1
- package/dist/number/enum/uint8.mjs.map +1 -1
- package/dist/number/refined-number-utils.mjs +0 -2
- package/dist/number/refined-number-utils.mjs.map +1 -1
- package/dist/promise/promise.d.mts +0 -1
- package/dist/promise/promise.d.mts.map +1 -1
- package/dist/promise/promise.mjs +2 -3
- package/dist/promise/promise.mjs.map +1 -1
- package/package.json +27 -21
- package/src/array/impl/array-utils-element-access.mts +6 -6
- package/src/array/impl/array-utils-element-access.test.mts +6 -6
- package/src/array/impl/array-utils-reducing-value.mts +8 -24
- package/src/array/impl/array-utils-reducing-value.test.mts +8 -8
- package/src/array/impl/array-utils-slice-clamped.test.mts +1 -1
- package/src/entry-point.mts +1 -0
- package/src/functional/index.mts +2 -2
- package/src/functional/optional/impl/index.mts +17 -0
- package/src/functional/optional/impl/optional-expect-to-be.mts +65 -0
- package/src/functional/optional/impl/optional-filter.mts +71 -0
- package/src/functional/optional/impl/optional-flat-map.mts +67 -0
- package/src/functional/optional/impl/optional-from-nullable.mts +28 -0
- package/src/functional/optional/impl/optional-is-none.mts +25 -0
- package/src/functional/optional/impl/optional-is-optional.mts +27 -0
- package/src/functional/optional/impl/optional-is-some.mts +25 -0
- package/src/functional/optional/impl/optional-map.mts +69 -0
- package/src/functional/optional/impl/optional-none.mts +17 -0
- package/src/functional/optional/impl/optional-or-else.mts +73 -0
- package/src/functional/optional/impl/optional-some.mts +23 -0
- package/src/functional/optional/impl/optional-to-nullable.mts +31 -0
- package/src/functional/optional/impl/optional-unwrap-or.mts +64 -0
- package/src/functional/optional/impl/optional-unwrap-throw.mts +39 -0
- package/src/functional/optional/impl/optional-unwrap.mts +41 -0
- package/src/functional/optional/impl/optional-zip.mts +40 -0
- package/src/functional/optional/impl/tag.mts +6 -0
- package/src/functional/optional/impl/types.mts +28 -0
- package/src/functional/optional/index.mts +1 -0
- package/src/functional/optional.test.mts +7 -8
- package/src/functional/pipe.mts +5 -5
- package/src/functional/pipe.test.mts +1 -1
- package/src/functional/result/impl/index.mts +23 -0
- package/src/functional/result/impl/result-err.mts +29 -0
- package/src/functional/result/impl/result-expect-to-be.mts +63 -0
- package/src/functional/result/impl/result-flat-map.mts +79 -0
- package/src/functional/result/impl/result-fold.mts +95 -0
- package/src/functional/result/impl/result-from-promise.mts +39 -0
- package/src/functional/result/impl/result-from-throwable.mts +42 -0
- package/src/functional/result/impl/result-is-err.mts +23 -0
- package/src/functional/result/impl/result-is-ok.mts +23 -0
- package/src/functional/result/impl/result-is-result.mts +23 -0
- package/src/functional/result/impl/result-map-err.mts +72 -0
- package/src/functional/result/impl/result-map.mts +73 -0
- package/src/functional/result/impl/result-ok.mts +29 -0
- package/src/functional/result/impl/result-or-else.mts +63 -0
- package/src/functional/result/impl/result-swap.mts +28 -0
- package/src/functional/result/impl/result-to-optional.mts +34 -0
- package/src/functional/result/impl/result-unwrap-err-or.mts +60 -0
- package/src/functional/result/impl/result-unwrap-err-throw.mts +53 -0
- package/src/functional/result/impl/result-unwrap-err.mts +36 -0
- package/src/functional/result/impl/result-unwrap-ok-or.mts +60 -0
- package/src/functional/result/impl/result-unwrap-ok.mts +35 -0
- package/src/functional/result/impl/result-unwrap-throw.mts +43 -0
- package/src/functional/result/impl/result-zip.mts +39 -0
- package/src/functional/result/impl/tag.mts +6 -0
- package/src/functional/result/impl/types.mts +35 -0
- package/src/functional/result/index.mts +1 -0
- package/src/functional/result.test.mts +5 -4
- package/src/globals.d.mts +83 -0
- package/src/guard/is-non-empty-string.test.mts +1 -1
- package/src/guard/is-non-null-object.test.mts +3 -3
- package/src/guard/is-primitive.test.mts +3 -3
- package/src/guard/is-type.test.mts +3 -3
- package/src/index.mts +0 -1
- package/src/number/branded-types/finite-number.mts +7 -7
- package/src/number/branded-types/int.mts +7 -7
- package/src/number/branded-types/int16.mts +9 -9
- package/src/number/branded-types/int32.mts +9 -9
- package/src/number/branded-types/non-negative-finite-number.mts +8 -8
- package/src/number/branded-types/non-negative-int16.mts +9 -9
- package/src/number/branded-types/non-negative-int32.mts +9 -9
- package/src/number/branded-types/non-zero-finite-number.mts +7 -7
- package/src/number/branded-types/non-zero-int.mts +7 -7
- package/src/number/branded-types/non-zero-int16.mts +9 -9
- package/src/number/branded-types/non-zero-int32.mts +9 -9
- package/src/number/branded-types/non-zero-safe-int.mts +9 -9
- package/src/number/branded-types/non-zero-uint16.mts +9 -9
- package/src/number/branded-types/non-zero-uint32.mts +9 -9
- package/src/number/branded-types/positive-finite-number.mts +8 -8
- package/src/number/branded-types/positive-int.mts +8 -8
- package/src/number/branded-types/positive-int16.mts +9 -9
- package/src/number/branded-types/positive-int32.mts +9 -9
- package/src/number/branded-types/positive-safe-int.mts +9 -9
- package/src/number/branded-types/positive-uint16.mts +9 -9
- package/src/number/branded-types/positive-uint32.mts +9 -9
- package/src/number/branded-types/safe-int.mts +9 -9
- package/src/number/branded-types/safe-uint.mts +9 -9
- package/src/number/branded-types/uint.mts +8 -8
- package/src/number/branded-types/uint16.mts +9 -9
- package/src/number/branded-types/uint32.mts +9 -9
- package/src/number/enum/int8.mts +3 -3
- package/src/number/enum/int8.test.mts +9 -9
- package/src/number/enum/uint8.mts +3 -3
- package/src/number/enum/uint8.test.mts +8 -8
- package/dist/functional/optional.d.mts +0 -482
- package/dist/functional/optional.d.mts.map +0 -1
- package/dist/functional/optional.mjs +0 -328
- package/dist/functional/optional.mjs.map +0 -1
- package/dist/functional/result.d.mts +0 -712
- package/dist/functional/result.d.mts.map +0 -1
- package/dist/functional/result.mjs +0 -539
- package/dist/functional/result.mjs.map +0 -1
- package/src/functional/optional.mts +0 -713
- package/src/functional/result.mts +0 -1087
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.mts","sourceRoot":"","sources":["../../src/functional/result.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,2EAA2E;AAC3E,QAAA,MAAM,aAAa,6BAA6B,CAAC;AAEjD,4EAA4E;AAC5E,QAAA,MAAM,cAAc,8BAA8B,CAAC;AAEnD;;;;GAIG;AACH,KAAK,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC;IACrB;;;OAGG;IACH,KAAK,EAAE,OAAO,aAAa,CAAC;IAE5B,yBAAyB;IACzB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC,CAAC;AAEH;;;;GAIG;AACH,KAAK,IAAI,CAAC,CAAC,IAAI,QAAQ,CAAC;IACtB;;;OAGG;IACH,KAAK,EAAE,OAAO,cAAc,CAAC;IAE7B,uBAAuB;IACvB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAE5C;;;GAGG;AACH,yBAAiB,MAAM,CAAC;IACtB;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,MAAM,QAAQ,GACnB,eAAe,OAAO,KACrB,aAAa,IAA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@@
|
|
|
1
|
-
import { isRecord } from '../guard/is-record.mjs';
|
|
2
|
-
import { unknownToString } from '../others/unknown-to-string.mjs';
|
|
3
|
-
import { Optional } from './optional.mjs';
|
|
4
|
-
|
|
5
|
-
/** @internal String literal tag to identify the 'Ok' variant of Result. */
|
|
6
|
-
const OkTypeTagName = 'ts-data-forge::Result.ok';
|
|
7
|
-
/** @internal String literal tag to identify the 'Err' variant of Result. */
|
|
8
|
-
const ErrTypeTagName = 'ts-data-forge::Result.err';
|
|
9
|
-
/**
|
|
10
|
-
* Namespace for the `Result` type and related functions. Provides utilities to
|
|
11
|
-
* handle operations that can succeed or fail.
|
|
12
|
-
*/
|
|
13
|
-
var Result;
|
|
14
|
-
(function (Result) {
|
|
15
|
-
/**
|
|
16
|
-
* Checks if the given value is a `Result`.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* ```ts
|
|
21
|
-
* const okValue = Result.ok('success');
|
|
22
|
-
* const errValue = Result.err(new Error('failure'));
|
|
23
|
-
* const notResult = { $$tag: 'ts-data-forge::Result.ok' };
|
|
24
|
-
*
|
|
25
|
-
* assert.ok(Result.isResult(okValue));
|
|
26
|
-
* assert.ok(Result.isResult(errValue));
|
|
27
|
-
* assert.notOk(Result.isResult(notResult));
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @param maybeOptional The value to check.
|
|
31
|
-
* @returns `true` if the value is a `Result`, otherwise `false`.
|
|
32
|
-
*/
|
|
33
|
-
Result.isResult = (maybeOptional) => isRecord(maybeOptional) &&
|
|
34
|
-
Object.hasOwn(maybeOptional, '$$tag') &&
|
|
35
|
-
Object.hasOwn(maybeOptional, 'value') &&
|
|
36
|
-
(maybeOptional['$$tag'] === ErrTypeTagName ||
|
|
37
|
-
maybeOptional['$$tag'] === OkTypeTagName);
|
|
38
|
-
/**
|
|
39
|
-
* Creates a `Result.Ok` containing the given success value.
|
|
40
|
-
*
|
|
41
|
-
* Use this constructor when an operation succeeds and you want to wrap the
|
|
42
|
-
* successful result in a Result type for consistent error handling.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
*
|
|
46
|
-
* ```ts
|
|
47
|
-
* const success = Result.ok({ id: 1 });
|
|
48
|
-
* const failure = Result.err(new Error('missing data'));
|
|
49
|
-
*
|
|
50
|
-
* assert.deepStrictEqual(success, {
|
|
51
|
-
* $$tag: 'ts-data-forge::Result.ok',
|
|
52
|
-
* value: { id: 1 },
|
|
53
|
-
* });
|
|
54
|
-
* assert.ok(Result.isErr(failure));
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @template S The type of the success value.
|
|
58
|
-
* @param value The success value.
|
|
59
|
-
* @returns A `Result.Ok<S>` containing the value.
|
|
60
|
-
*/
|
|
61
|
-
Result.ok = (value) => ({
|
|
62
|
-
$$tag: OkTypeTagName,
|
|
63
|
-
value,
|
|
64
|
-
});
|
|
65
|
-
/**
|
|
66
|
-
* Creates a `Result.Err` containing the given error value.
|
|
67
|
-
*
|
|
68
|
-
* Use this constructor when an operation fails and you want to wrap the error
|
|
69
|
-
* information in a Result type for consistent error handling.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
*
|
|
73
|
-
* ```ts
|
|
74
|
-
* const success = Result.ok({ id: 1 });
|
|
75
|
-
* const failure = Result.err(new Error('missing data'));
|
|
76
|
-
*
|
|
77
|
-
* assert.deepStrictEqual(success, {
|
|
78
|
-
* $$tag: 'ts-data-forge::Result.ok',
|
|
79
|
-
* value: { id: 1 },
|
|
80
|
-
* });
|
|
81
|
-
* assert.ok(Result.isErr(failure));
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @template E The type of the error value.
|
|
85
|
-
* @param value The error value.
|
|
86
|
-
* @returns A `Result.Err<E>` containing the value.
|
|
87
|
-
*/
|
|
88
|
-
Result.err = (value) => ({
|
|
89
|
-
$$tag: ErrTypeTagName,
|
|
90
|
-
value,
|
|
91
|
-
});
|
|
92
|
-
/**
|
|
93
|
-
* @internal
|
|
94
|
-
* Default string conversion function using native String constructor.
|
|
95
|
-
*/
|
|
96
|
-
const toStr_ = String;
|
|
97
|
-
/**
|
|
98
|
-
* Checks if a `Result` is `Result.Ok`. Acts as a type guard, narrowing the
|
|
99
|
-
* type to the success variant.
|
|
100
|
-
*
|
|
101
|
-
* This function is essential for type-safe Result handling, allowing
|
|
102
|
-
* TypeScript to understand that subsequent operations will work with the
|
|
103
|
-
* success value rather than the error value.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
*
|
|
107
|
-
* ```ts
|
|
108
|
-
* const operation = Result.ok(3);
|
|
109
|
-
* const failure = Result.err('error');
|
|
110
|
-
*
|
|
111
|
-
* if (Result.isOk(operation)) {
|
|
112
|
-
* const value: number = operation.value;
|
|
113
|
-
* assert(value === 3);
|
|
114
|
-
* }
|
|
115
|
-
*
|
|
116
|
-
* assert.ok(Result.isErr(failure));
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* @template R The `Result.Base` type to check.
|
|
120
|
-
* @param result The `Result` to check.
|
|
121
|
-
* @returns `true` if the `Result` is `Result.Ok`, otherwise `false`.
|
|
122
|
-
*/
|
|
123
|
-
Result.isOk = (result) => result.$$tag === OkTypeTagName;
|
|
124
|
-
/**
|
|
125
|
-
* Checks if a `Result` is `Result.Err`. Acts as a type guard, narrowing the
|
|
126
|
-
* type to the error variant.
|
|
127
|
-
*
|
|
128
|
-
* This function is essential for type-safe Result handling, allowing
|
|
129
|
-
* TypeScript to understand that subsequent operations will work with the
|
|
130
|
-
* error value rather than the success value.
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
*
|
|
134
|
-
* ```ts
|
|
135
|
-
* const operation = Result.ok(3);
|
|
136
|
-
* const failure = Result.err('error');
|
|
137
|
-
*
|
|
138
|
-
* if (Result.isOk(operation)) {
|
|
139
|
-
* const value: number = operation.value;
|
|
140
|
-
* assert(value === 3);
|
|
141
|
-
* }
|
|
142
|
-
*
|
|
143
|
-
* assert.ok(Result.isErr(failure));
|
|
144
|
-
* ```
|
|
145
|
-
*
|
|
146
|
-
* @template R The `Result.Base` type to check.
|
|
147
|
-
* @param result The `Result` to check.
|
|
148
|
-
* @returns `true` if the `Result` is `Result.Err`, otherwise `false`.
|
|
149
|
-
*/
|
|
150
|
-
Result.isErr = (result) => result.$$tag === ErrTypeTagName;
|
|
151
|
-
/**
|
|
152
|
-
* Unwraps a `Result`, returning the success value. Throws an error if the
|
|
153
|
-
* `Result` is `Result.Err`.
|
|
154
|
-
*
|
|
155
|
-
* This is useful when you're confident that a Result should contain a success
|
|
156
|
-
* value and want to treat errors as exceptional conditions. The error message
|
|
157
|
-
* will be constructed from the error value using the provided string
|
|
158
|
-
* conversion function.
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
*
|
|
162
|
-
* ```ts
|
|
163
|
-
* const okResult = Result.ok('data');
|
|
164
|
-
* const errResult = Result.err(new Error('fail'));
|
|
165
|
-
*
|
|
166
|
-
* assert(Result.unwrapThrow(okResult) === 'data');
|
|
167
|
-
* assert.throws(() => Result.unwrapThrow(errResult), /fail/u);
|
|
168
|
-
* ```
|
|
169
|
-
*
|
|
170
|
-
* @template R The `Result.Base` type to unwrap.
|
|
171
|
-
* @param result The `Result` to unwrap.
|
|
172
|
-
* @param toStr An optional function to convert the error value to a string
|
|
173
|
-
* for the error message. Defaults to `String`.
|
|
174
|
-
* @returns The success value if `Result.Ok`.
|
|
175
|
-
* @throws {Error} Error with the stringified error value if the `Result` is
|
|
176
|
-
* `Result.Err`.
|
|
177
|
-
*/
|
|
178
|
-
Result.unwrapThrow = (result, toStr = toStr_) => {
|
|
179
|
-
if (Result.isErr(result)) {
|
|
180
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
181
|
-
throw new Error(toStr(result.value));
|
|
182
|
-
}
|
|
183
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
184
|
-
return result.value;
|
|
185
|
-
};
|
|
186
|
-
function unwrapOk(result) {
|
|
187
|
-
return Result.isErr(result)
|
|
188
|
-
? undefined
|
|
189
|
-
: // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
190
|
-
result.value;
|
|
191
|
-
}
|
|
192
|
-
Result.unwrapOk = unwrapOk;
|
|
193
|
-
function unwrapOkOr(...args) {
|
|
194
|
-
switch (args.length) {
|
|
195
|
-
case 2: {
|
|
196
|
-
// Direct version: first argument is result
|
|
197
|
-
const [result, defaultValue] = args;
|
|
198
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
199
|
-
return Result.isErr(result) ? defaultValue : result.value;
|
|
200
|
-
}
|
|
201
|
-
case 1: {
|
|
202
|
-
// Curried version: first argument is default value
|
|
203
|
-
const [defaultValue] = args;
|
|
204
|
-
return (result) => unwrapOkOr(result, defaultValue);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
Result.unwrapOkOr = unwrapOkOr;
|
|
209
|
-
/**
|
|
210
|
-
* Unwraps a `Result`, returning the error value. Throws an error if the
|
|
211
|
-
* `Result` is `Result.Ok`.
|
|
212
|
-
*
|
|
213
|
-
* This function is used when you expect a Result to be an error and want to
|
|
214
|
-
* extract the error value. If the Result is unexpectedly Ok, it will throw an
|
|
215
|
-
* error with information about the unexpected success value.
|
|
216
|
-
*
|
|
217
|
-
* @example
|
|
218
|
-
*
|
|
219
|
-
* ```ts
|
|
220
|
-
* const errResult = Result.err(new Error('broken'));
|
|
221
|
-
* const okResult = Result.ok('value');
|
|
222
|
-
*
|
|
223
|
-
* assert(Result.unwrapErrThrow(errResult).message === 'broken');
|
|
224
|
-
* assert.throws(() => Result.unwrapErrThrow(okResult), /Expected Err/u);
|
|
225
|
-
* ```
|
|
226
|
-
*
|
|
227
|
-
* @template R The `Result.Base` type to unwrap.
|
|
228
|
-
* @param result The `Result` to unwrap.
|
|
229
|
-
* @param toStr An optional function to convert the success value to a string
|
|
230
|
-
* for the error message when the Result is unexpectedly Ok. Defaults to
|
|
231
|
-
* `String`.
|
|
232
|
-
* @returns The error value if `Result.Err`.
|
|
233
|
-
* @throws {Error} Error with message "Expected Err but got Ok: {value}" if
|
|
234
|
-
* the `Result` is `Result.Ok`.
|
|
235
|
-
*/
|
|
236
|
-
Result.unwrapErrThrow = (result, toStr = toStr_) => {
|
|
237
|
-
if (Result.isOk(result)) {
|
|
238
|
-
throw new Error(
|
|
239
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
240
|
-
`Expected Err but got Ok: ${toStr(result.value)}`);
|
|
241
|
-
}
|
|
242
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
243
|
-
return result.value;
|
|
244
|
-
};
|
|
245
|
-
/**
|
|
246
|
-
* Unwraps a `Result`, returning the error value or `undefined` if it is
|
|
247
|
-
* `Result.Ok`.
|
|
248
|
-
*
|
|
249
|
-
* This provides a safe way to extract error values from Results without
|
|
250
|
-
* throwing exceptions. Useful for error handling patterns where you want to
|
|
251
|
-
* check for specific error conditions.
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
*
|
|
255
|
-
* ```ts
|
|
256
|
-
* const okResult = Result.ok('data');
|
|
257
|
-
* const errResult = Result.err('problem');
|
|
258
|
-
*
|
|
259
|
-
* // Result.unwrapErr returns undefined for Ok results
|
|
260
|
-
* // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
261
|
-
* assert(Result.unwrapErr(okResult) === undefined);
|
|
262
|
-
*
|
|
263
|
-
* // Result.unwrapErr returns the error value for Err results
|
|
264
|
-
*
|
|
265
|
-
* assert(Result.unwrapErr(errResult) === 'problem');
|
|
266
|
-
* ```
|
|
267
|
-
*
|
|
268
|
-
* @template R The `Result.Base` type to unwrap.
|
|
269
|
-
* @param result The `Result` to unwrap.
|
|
270
|
-
* @returns The error value if `Result.Err`, otherwise `undefined`.
|
|
271
|
-
*/
|
|
272
|
-
Result.unwrapErr = (result) =>
|
|
273
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
274
|
-
Result.isErr(result) ? result.value : undefined;
|
|
275
|
-
function unwrapErrOr(...args) {
|
|
276
|
-
switch (args.length) {
|
|
277
|
-
case 2: {
|
|
278
|
-
// Direct version: first argument is result
|
|
279
|
-
const [result, defaultValue] = args;
|
|
280
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
281
|
-
return Result.isErr(result) ? result.value : defaultValue;
|
|
282
|
-
}
|
|
283
|
-
case 1: {
|
|
284
|
-
// Curried version: first argument is default value
|
|
285
|
-
const [defaultValue] = args;
|
|
286
|
-
return (result) => unwrapErrOr(result, defaultValue);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
Result.unwrapErrOr = unwrapErrOr;
|
|
291
|
-
function map(...args) {
|
|
292
|
-
switch (args.length) {
|
|
293
|
-
case 2: {
|
|
294
|
-
const [result, mapFn] = args;
|
|
295
|
-
return Result.isErr(result)
|
|
296
|
-
? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
297
|
-
result
|
|
298
|
-
: // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
299
|
-
Result.ok(mapFn(result.value));
|
|
300
|
-
}
|
|
301
|
-
case 1: {
|
|
302
|
-
// Curried version: first argument is mapping function
|
|
303
|
-
const [mapFn] = args;
|
|
304
|
-
return (result) => map(result, mapFn);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
Result.map = map;
|
|
309
|
-
function mapErr(...args) {
|
|
310
|
-
switch (args.length) {
|
|
311
|
-
case 2: {
|
|
312
|
-
const [result, mapFn] = args;
|
|
313
|
-
return Result.isOk(result)
|
|
314
|
-
? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
315
|
-
result
|
|
316
|
-
: // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
317
|
-
Result.err(mapFn(result.value));
|
|
318
|
-
}
|
|
319
|
-
case 1: {
|
|
320
|
-
// Curried version: first argument is mapping function
|
|
321
|
-
const [mapFn] = args;
|
|
322
|
-
return (result) => mapErr(result, mapFn);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
Result.mapErr = mapErr;
|
|
327
|
-
function fold(...args) {
|
|
328
|
-
switch (args.length) {
|
|
329
|
-
case 3: {
|
|
330
|
-
const [result, mapFn, mapErrFn] = args;
|
|
331
|
-
return Result.isOk(result)
|
|
332
|
-
? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
333
|
-
Result.ok(mapFn(result.value))
|
|
334
|
-
: // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
335
|
-
Result.err(mapErrFn(result.value));
|
|
336
|
-
}
|
|
337
|
-
case 2: {
|
|
338
|
-
const [mapFn, mapErrFn] = args;
|
|
339
|
-
return (result) => Result.isOk(result) ? Result.ok(mapFn(result.value)) : Result.err(mapErrFn(result.value));
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
Result.fold = fold;
|
|
344
|
-
function flatMap(...args) {
|
|
345
|
-
switch (args.length) {
|
|
346
|
-
case 2: {
|
|
347
|
-
const [result, flatMapFn] = args;
|
|
348
|
-
return Result.isErr(result)
|
|
349
|
-
? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
350
|
-
result
|
|
351
|
-
: // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
352
|
-
flatMapFn(result.value);
|
|
353
|
-
}
|
|
354
|
-
case 1: {
|
|
355
|
-
const [flatMapFn] = args;
|
|
356
|
-
return (result) => Result.isErr(result) ? result : flatMapFn(result.value);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
Result.flatMap = flatMap;
|
|
361
|
-
function expectToBe(...args) {
|
|
362
|
-
switch (args.length) {
|
|
363
|
-
case 2: {
|
|
364
|
-
// Direct version: first argument is result
|
|
365
|
-
const [result, message] = args;
|
|
366
|
-
if (Result.isOk(result)) {
|
|
367
|
-
return unwrapOk(result);
|
|
368
|
-
}
|
|
369
|
-
throw new Error(message);
|
|
370
|
-
}
|
|
371
|
-
case 1: {
|
|
372
|
-
// Curried version: first argument is message
|
|
373
|
-
const [message] = args;
|
|
374
|
-
return (result) => expectToBe(result, message);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
Result.expectToBe = expectToBe;
|
|
379
|
-
/**
|
|
380
|
-
* Converts a Promise into a Promise that resolves to a `Result`. If the input
|
|
381
|
-
* Promise resolves, the `Result` will be `Ok` with the resolved value. If the
|
|
382
|
-
* input Promise rejects, the `Result` will be `Err` with the rejection
|
|
383
|
-
* reason.
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
*
|
|
387
|
-
* ```ts
|
|
388
|
-
* const successPromise = Result.fromPromise(Promise.resolve('ok'));
|
|
389
|
-
* const failurePromise = Result.fromPromise(Promise.reject(new Error('fail')));
|
|
390
|
-
*
|
|
391
|
-
* const resolved = await successPromise;
|
|
392
|
-
* const rejected = await failurePromise;
|
|
393
|
-
*
|
|
394
|
-
* assert.deepStrictEqual(resolved, Result.ok('ok'));
|
|
395
|
-
* assert.ok(Result.isErr(rejected));
|
|
396
|
-
* ```
|
|
397
|
-
*
|
|
398
|
-
* @template P The type of the input Promise.
|
|
399
|
-
* @param promise The Promise to convert.
|
|
400
|
-
* @returns A Promise that resolves to `Result<UnwrapPromise<P>, unknown>`.
|
|
401
|
-
*/
|
|
402
|
-
Result.fromPromise = (promise) =>
|
|
403
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
404
|
-
promise.then((v) => Result.ok(v)).catch(Result.err);
|
|
405
|
-
/**
|
|
406
|
-
* Wraps a function that may throw an exception in a `Result`.
|
|
407
|
-
*
|
|
408
|
-
* This is a fundamental utility for converting traditional exception-based
|
|
409
|
-
* error handling into Result-based error handling. Any thrown value is
|
|
410
|
-
* converted to an Error object for consistent error handling.
|
|
411
|
-
*
|
|
412
|
-
* If the function executes successfully, returns `Result.Ok` with the result.
|
|
413
|
-
* If the function throws, returns `Result.Err` with the caught error.
|
|
414
|
-
*
|
|
415
|
-
* @example
|
|
416
|
-
*
|
|
417
|
-
* ```ts
|
|
418
|
-
* const success = Result.fromThrowable(() => 1 + 1);
|
|
419
|
-
* const failure = Result.fromThrowable(() => {
|
|
420
|
-
* throw new Error('boom');
|
|
421
|
-
* });
|
|
422
|
-
*
|
|
423
|
-
* assert.deepStrictEqual(success, Result.ok(2));
|
|
424
|
-
* assert.ok(Result.isErr(failure));
|
|
425
|
-
* ```
|
|
426
|
-
*
|
|
427
|
-
* @template T The return type of the function.
|
|
428
|
-
* @param fn The function to execute that may throw.
|
|
429
|
-
* @returns A `Result<T, Error>` containing either the successful result or
|
|
430
|
-
* the caught error.
|
|
431
|
-
*/
|
|
432
|
-
Result.fromThrowable = (fn) => {
|
|
433
|
-
try {
|
|
434
|
-
return Result.ok(fn());
|
|
435
|
-
}
|
|
436
|
-
catch (error) {
|
|
437
|
-
if (Error.isError(error)) {
|
|
438
|
-
return Result.err(error);
|
|
439
|
-
}
|
|
440
|
-
const msg = unknownToString(error);
|
|
441
|
-
return Result.err(new Error(msg));
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
/**
|
|
445
|
-
* Swaps the success and error values of a `Result`.
|
|
446
|
-
*
|
|
447
|
-
* @example
|
|
448
|
-
*
|
|
449
|
-
* ```ts
|
|
450
|
-
* const okValue = Result.ok('value');
|
|
451
|
-
* const errValue = Result.err('error');
|
|
452
|
-
*
|
|
453
|
-
* assert.deepStrictEqual(Result.swap(okValue), Result.err('value'));
|
|
454
|
-
* assert.deepStrictEqual(Result.swap(errValue), Result.ok('error'));
|
|
455
|
-
* ```
|
|
456
|
-
*
|
|
457
|
-
* @template R The input `Result.Base` type.
|
|
458
|
-
* @param result The `Result` to swap.
|
|
459
|
-
* @returns A new `Result` with success and error swapped.
|
|
460
|
-
*/
|
|
461
|
-
Result.swap = (result) =>
|
|
462
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
463
|
-
Result.isOk(result) ? Result.err(unwrapOk(result)) : Result.ok(result.value);
|
|
464
|
-
/**
|
|
465
|
-
* Converts a `Result` to an `Optional`.
|
|
466
|
-
*
|
|
467
|
-
* This conversion is useful when you want to discard error information and
|
|
468
|
-
* only care about whether an operation succeeded. The error information is
|
|
469
|
-
* lost in this conversion, so use it when error details are not needed.
|
|
470
|
-
*
|
|
471
|
-
* If the `Result` is `Ok`, returns `Some` with the value. If the `Result` is
|
|
472
|
-
* `Err`, returns `None`.
|
|
473
|
-
*
|
|
474
|
-
* @example
|
|
475
|
-
*
|
|
476
|
-
* ```ts
|
|
477
|
-
* const okValue = Result.ok(7);
|
|
478
|
-
* const errValue = Result.err('fail');
|
|
479
|
-
*
|
|
480
|
-
* assert.deepStrictEqual(Result.toOptional(okValue), Optional.some(7));
|
|
481
|
-
* assert.deepStrictEqual(Result.toOptional(errValue), Optional.none);
|
|
482
|
-
* ```
|
|
483
|
-
*
|
|
484
|
-
* @template R The input `Result.Base` type.
|
|
485
|
-
* @param result The `Result` to convert.
|
|
486
|
-
* @returns An `Optional<UnwrapOk<R>>` containing the success value or
|
|
487
|
-
* representing `None`.
|
|
488
|
-
*/
|
|
489
|
-
Result.toOptional = (result) => Result.isOk(result) ? Optional.some(unwrapOk(result)) : Optional.none;
|
|
490
|
-
function orElse(...args) {
|
|
491
|
-
switch (args.length) {
|
|
492
|
-
case 2: {
|
|
493
|
-
const [result, alternative] = args;
|
|
494
|
-
return Result.isOk(result) ? result : alternative;
|
|
495
|
-
}
|
|
496
|
-
case 1: {
|
|
497
|
-
// Curried version: one argument (alternative) provided
|
|
498
|
-
const [alternative] = args;
|
|
499
|
-
return (result) => orElse(result, alternative);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
Result.orElse = orElse;
|
|
504
|
-
/**
|
|
505
|
-
* Combines two `Result` values into a single `Result` containing a tuple. If
|
|
506
|
-
* either `Result` is `Err`, returns the first `Err` encountered.
|
|
507
|
-
*
|
|
508
|
-
* @example
|
|
509
|
-
*
|
|
510
|
-
* ```ts
|
|
511
|
-
* const first = Result.ok('left');
|
|
512
|
-
* const second = Result.ok(1);
|
|
513
|
-
*
|
|
514
|
-
* const expected: readonly [string, number] = ['left', 1];
|
|
515
|
-
*
|
|
516
|
-
* assert.deepStrictEqual(Result.zip(first, second), Result.ok(expected));
|
|
517
|
-
* assert.deepStrictEqual(
|
|
518
|
-
* Result.zip(first, Result.err('error')),
|
|
519
|
-
* Result.err('error'),
|
|
520
|
-
* );
|
|
521
|
-
* ```
|
|
522
|
-
*
|
|
523
|
-
* @template S1 The success type of the first `Result`.
|
|
524
|
-
* @template E1 The error type of the first `Result`.
|
|
525
|
-
* @template S2 The success type of the second `Result`.
|
|
526
|
-
* @template E2 The error type of the second `Result`.
|
|
527
|
-
* @param resultA The first `Result`.
|
|
528
|
-
* @param resultB The second `Result`.
|
|
529
|
-
* @returns A `Result` containing a tuple of both values, or the first `Err`.
|
|
530
|
-
*/
|
|
531
|
-
Result.zip = (resultA, resultB) => Result.isOk(resultA)
|
|
532
|
-
? Result.isOk(resultB)
|
|
533
|
-
? Result.ok([resultA.value, resultB.value])
|
|
534
|
-
: resultB
|
|
535
|
-
: resultA;
|
|
536
|
-
})(Result || (Result = {}));
|
|
537
|
-
|
|
538
|
-
export { Result };
|
|
539
|
-
//# sourceMappingURL=result.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result.mjs","sources":["../../src/functional/result.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIA;AACA,MAAM,aAAa,GAAG,0BAA0B;AAEhD;AACA,MAAM,cAAc,GAAG,2BAA2B;AA0ClD;;;AAGG;AACG,IAAW;AAAjB,CAAA,UAAiB,MAAM,EAAA;AACrB;;;;;;;;;;;;;;;;;AAiBG;IACU,MAAA,CAAA,QAAQ,GAAG,CACtB,aAAsB,KAEt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