ts-data-forge 14.6.3 → 14.7.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/README.md +2 -1
- package/dist/array/impl/array-utils-modification.mjs +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +2 -2
- package/dist/expect-type.d.mts +2 -70
- package/dist/expect-type.d.mts.map +1 -1
- package/dist/expect-type.mjs +1 -68
- package/dist/expect-type.mjs.map +1 -1
- package/dist/functional/index.d.mts +11 -6
- package/dist/functional/index.d.mts.map +1 -1
- package/dist/functional/index.mjs +10 -6
- package/dist/functional/index.mjs.map +1 -1
- package/dist/guard/has-key.d.mts +2 -51
- package/dist/guard/has-key.d.mts.map +1 -1
- package/dist/guard/has-key.mjs +1 -41
- package/dist/guard/has-key.mjs.map +1 -1
- package/dist/guard/is-non-null-object.d.mts +2 -34
- package/dist/guard/is-non-null-object.d.mts.map +1 -1
- package/dist/guard/is-non-null-object.mjs +1 -34
- package/dist/guard/is-non-null-object.mjs.map +1 -1
- package/dist/guard/is-record.d.mts +2 -89
- package/dist/guard/is-record.d.mts.map +1 -1
- package/dist/guard/is-record.mjs +1 -88
- package/dist/guard/is-record.mjs.map +1 -1
- package/dist/guard/key-is-in.d.mts +2 -42
- package/dist/guard/key-is-in.d.mts.map +1 -1
- package/dist/guard/key-is-in.mjs +1 -40
- package/dist/guard/key-is-in.mjs.map +1 -1
- package/dist/number/num.d.mts +9 -1
- package/dist/number/num.d.mts.map +1 -1
- package/dist/number/num.mjs +24 -16
- package/dist/number/num.mjs.map +1 -1
- package/dist/others/index.d.mts +1 -0
- package/dist/others/index.d.mts.map +1 -1
- package/dist/others/index.mjs +1 -0
- package/dist/others/index.mjs.map +1 -1
- package/dist/others/panic-error.d.mts +9 -0
- package/dist/others/panic-error.d.mts.map +1 -0
- package/dist/others/panic-error.mjs +9 -0
- package/dist/others/panic-error.mjs.map +1 -0
- package/dist/others/unknown-to-string.d.mts +2 -37
- package/dist/others/unknown-to-string.d.mts.map +1 -1
- package/dist/others/unknown-to-string.mjs +1 -92
- package/dist/others/unknown-to-string.mjs.map +1 -1
- package/dist/types.d.mts +1 -41
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +0 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +6 -6
- package/src/expect-type.mts +2 -78
- package/src/functional/index.mts +31 -6
- package/src/guard/has-key.mts +2 -72
- package/src/guard/is-non-null-object.mts +2 -36
- package/src/guard/is-record.mts +2 -95
- package/src/guard/key-is-in.mts +2 -49
- package/src/number/num.mts +36 -28
- package/src/others/index.mts +1 -0
- package/src/others/panic-error.mts +8 -0
- package/src/others/unknown-to-string.mts +2 -111
- package/src/types.mts +4 -54
- package/dist/functional/async-result/async-result.d.mts +0 -16
- package/dist/functional/async-result/async-result.d.mts.map +0 -1
- package/dist/functional/async-result/async-result.mjs +0 -2
- package/dist/functional/async-result/async-result.mjs.map +0 -1
- package/dist/functional/async-result/impl/async-result-flat-map.d.mts +0 -39
- package/dist/functional/async-result/impl/async-result-flat-map.d.mts.map +0 -1
- package/dist/functional/async-result/impl/async-result-flat-map.mjs +0 -23
- package/dist/functional/async-result/impl/async-result-flat-map.mjs.map +0 -1
- package/dist/functional/async-result/impl/async-result-from-promise.d.mts +0 -47
- package/dist/functional/async-result/impl/async-result-from-promise.d.mts.map +0 -1
- package/dist/functional/async-result/impl/async-result-from-promise.mjs +0 -10
- package/dist/functional/async-result/impl/async-result-from-promise.mjs.map +0 -1
- package/dist/functional/async-result/impl/async-result-from-throwable.d.mts +0 -53
- package/dist/functional/async-result/impl/async-result-from-throwable.d.mts.map +0 -1
- package/dist/functional/async-result/impl/async-result-from-throwable.mjs +0 -15
- package/dist/functional/async-result/impl/async-result-from-throwable.mjs.map +0 -1
- package/dist/functional/async-result/impl/async-result-map-err.d.mts +0 -35
- package/dist/functional/async-result/impl/async-result-map-err.d.mts.map +0 -1
- package/dist/functional/async-result/impl/async-result-map-err.mjs +0 -20
- package/dist/functional/async-result/impl/async-result-map-err.mjs.map +0 -1
- package/dist/functional/async-result/impl/async-result-map.d.mts +0 -45
- package/dist/functional/async-result/impl/async-result-map.d.mts.map +0 -1
- package/dist/functional/async-result/impl/async-result-map.mjs +0 -20
- package/dist/functional/async-result/impl/async-result-map.mjs.map +0 -1
- package/dist/functional/async-result/impl/async-result-unwrap-or.d.mts +0 -34
- package/dist/functional/async-result/impl/async-result-unwrap-or.d.mts.map +0 -1
- package/dist/functional/async-result/impl/async-result-unwrap-or.mjs +0 -37
- package/dist/functional/async-result/impl/async-result-unwrap-or.mjs.map +0 -1
- package/dist/functional/async-result/impl/index.d.mts +0 -8
- package/dist/functional/async-result/impl/index.d.mts.map +0 -1
- package/dist/functional/async-result/impl/index.mjs +0 -8
- package/dist/functional/async-result/impl/index.mjs.map +0 -1
- package/dist/functional/async-result/impl/types.d.mts +0 -45
- package/dist/functional/async-result/impl/types.d.mts.map +0 -1
- package/dist/functional/async-result/impl/types.mjs +0 -2
- package/dist/functional/async-result/impl/types.mjs.map +0 -1
- package/dist/functional/async-result/index.d.mts +0 -2
- package/dist/functional/async-result/index.d.mts.map +0 -1
- package/dist/functional/async-result/index.mjs +0 -2
- package/dist/functional/async-result/index.mjs.map +0 -1
- package/dist/functional/match.d.mts +0 -80
- package/dist/functional/match.d.mts.map +0 -1
- package/dist/functional/match.mjs +0 -31
- package/dist/functional/match.mjs.map +0 -1
- package/dist/functional/optional/impl/index.d.mts +0 -19
- package/dist/functional/optional/impl/index.d.mts.map +0 -1
- package/dist/functional/optional/impl/index.mjs +0 -19
- package/dist/functional/optional/impl/index.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts +0 -37
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-expect-to-be.mjs +0 -22
- package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-filter.d.mts +0 -33
- package/dist/functional/optional/impl/optional-filter.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-filter.mjs +0 -25
- package/dist/functional/optional/impl/optional-filter.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-flat-map.d.mts +0 -39
- package/dist/functional/optional/impl/optional-flat-map.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-flat-map.mjs +0 -18
- package/dist/functional/optional/impl/optional-flat-map.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-from-nullable.d.mts +0 -27
- package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-from-nullable.mjs +0 -28
- package/dist/functional/optional/impl/optional-from-nullable.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-is-none.d.mts +0 -23
- package/dist/functional/optional/impl/optional-is-none.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-is-none.mjs +0 -22
- package/dist/functional/optional/impl/optional-is-none.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-is-optional.d.mts +0 -21
- package/dist/functional/optional/impl/optional-is-optional.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-is-optional.mjs +0 -26
- package/dist/functional/optional/impl/optional-is-optional.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-is-some.d.mts +0 -24
- package/dist/functional/optional/impl/optional-is-some.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-is-some.mjs +0 -23
- package/dist/functional/optional/impl/optional-is-some.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-map.d.mts +0 -34
- package/dist/functional/optional/impl/optional-map.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-map.mjs +0 -22
- package/dist/functional/optional/impl/optional-map.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-match.d.mts +0 -48
- package/dist/functional/optional/impl/optional-match.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-match.mjs +0 -20
- package/dist/functional/optional/impl/optional-match.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-none.d.mts +0 -19
- package/dist/functional/optional/impl/optional-none.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-none.mjs +0 -19
- package/dist/functional/optional/impl/optional-none.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-or-else.d.mts +0 -43
- package/dist/functional/optional/impl/optional-or-else.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-or-else.mjs +0 -16
- package/dist/functional/optional/impl/optional-or-else.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-some.d.mts +0 -22
- package/dist/functional/optional/impl/optional-some.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-some.mjs +0 -25
- package/dist/functional/optional/impl/optional-some.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-to-nullable.d.mts +0 -30
- package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-to-nullable.mjs +0 -30
- package/dist/functional/optional/impl/optional-to-nullable.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts +0 -37
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-unwrap-or.mjs +0 -16
- package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +0 -31
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs +0 -36
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-unwrap.d.mts +0 -32
- package/dist/functional/optional/impl/optional-unwrap.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-unwrap.mjs +0 -8
- package/dist/functional/optional/impl/optional-unwrap.mjs.map +0 -1
- package/dist/functional/optional/impl/optional-zip.d.mts +0 -35
- package/dist/functional/optional/impl/optional-zip.d.mts.map +0 -1
- package/dist/functional/optional/impl/optional-zip.mjs +0 -39
- package/dist/functional/optional/impl/optional-zip.mjs.map +0 -1
- package/dist/functional/optional/impl/tag.d.mts +0 -6
- package/dist/functional/optional/impl/tag.d.mts.map +0 -1
- package/dist/functional/optional/impl/tag.mjs +0 -4
- package/dist/functional/optional/impl/tag.mjs.map +0 -1
- package/dist/functional/optional/impl/types.d.mts +0 -24
- package/dist/functional/optional/impl/types.d.mts.map +0 -1
- package/dist/functional/optional/impl/types.mjs +0 -2
- package/dist/functional/optional/impl/types.mjs.map +0 -1
- package/dist/functional/optional/index.d.mts +0 -2
- package/dist/functional/optional/index.d.mts.map +0 -1
- package/dist/functional/optional/index.mjs +0 -2
- package/dist/functional/optional/index.mjs.map +0 -1
- package/dist/functional/optional/optional.d.mts +0 -16
- package/dist/functional/optional/optional.d.mts.map +0 -1
- package/dist/functional/optional/optional.mjs +0 -2
- package/dist/functional/optional/optional.mjs.map +0 -1
- package/dist/functional/pipe.d.mts +0 -102
- package/dist/functional/pipe.d.mts.map +0 -1
- package/dist/functional/pipe.mjs +0 -45
- package/dist/functional/pipe.mjs.map +0 -1
- package/dist/functional/result/impl/index.d.mts +0 -28
- package/dist/functional/result/impl/index.d.mts.map +0 -1
- package/dist/functional/result/impl/index.mjs +0 -28
- package/dist/functional/result/impl/index.mjs.map +0 -1
- package/dist/functional/result/impl/result-err.d.mts +0 -28
- package/dist/functional/result/impl/result-err.d.mts.map +0 -1
- package/dist/functional/result/impl/result-err.mjs +0 -31
- package/dist/functional/result/impl/result-err.mjs.map +0 -1
- package/dist/functional/result/impl/result-expect-to-be.d.mts +0 -33
- package/dist/functional/result/impl/result-expect-to-be.d.mts.map +0 -1
- package/dist/functional/result/impl/result-expect-to-be.mjs +0 -23
- package/dist/functional/result/impl/result-expect-to-be.mjs.map +0 -1
- package/dist/functional/result/impl/result-flat-map.d.mts +0 -45
- package/dist/functional/result/impl/result-flat-map.d.mts.map +0 -1
- package/dist/functional/result/impl/result-flat-map.mjs +0 -21
- package/dist/functional/result/impl/result-flat-map.mjs.map +0 -1
- package/dist/functional/result/impl/result-fold.d.mts +0 -50
- package/dist/functional/result/impl/result-fold.d.mts.map +0 -1
- package/dist/functional/result/impl/result-fold.mjs +0 -23
- package/dist/functional/result/impl/result-fold.mjs.map +0 -1
- package/dist/functional/result/impl/result-from-optional.d.mts +0 -41
- package/dist/functional/result/impl/result-from-optional.d.mts.map +0 -1
- package/dist/functional/result/impl/result-from-optional.mjs +0 -21
- package/dist/functional/result/impl/result-from-optional.mjs.map +0 -1
- package/dist/functional/result/impl/result-from-promise.d.mts +0 -43
- package/dist/functional/result/impl/result-from-promise.d.mts.map +0 -1
- package/dist/functional/result/impl/result-from-promise.mjs +0 -39
- package/dist/functional/result/impl/result-from-promise.mjs.map +0 -1
- package/dist/functional/result/impl/result-from-throwable.d.mts +0 -32
- package/dist/functional/result/impl/result-from-throwable.d.mts.map +0 -1
- package/dist/functional/result/impl/result-from-throwable.mjs +0 -46
- package/dist/functional/result/impl/result-from-throwable.mjs.map +0 -1
- package/dist/functional/result/impl/result-is-err.d.mts +0 -23
- package/dist/functional/result/impl/result-is-err.d.mts.map +0 -1
- package/dist/functional/result/impl/result-is-err.mjs +0 -22
- package/dist/functional/result/impl/result-is-err.mjs.map +0 -1
- package/dist/functional/result/impl/result-is-ok.d.mts +0 -23
- package/dist/functional/result/impl/result-is-ok.d.mts.map +0 -1
- package/dist/functional/result/impl/result-is-ok.mjs +0 -22
- package/dist/functional/result/impl/result-is-ok.mjs.map +0 -1
- package/dist/functional/result/impl/result-is-result.d.mts +0 -22
- package/dist/functional/result/impl/result-is-result.d.mts.map +0 -1
- package/dist/functional/result/impl/result-is-result.mjs +0 -26
- package/dist/functional/result/impl/result-is-result.mjs.map +0 -1
- package/dist/functional/result/impl/result-map-err.d.mts +0 -39
- package/dist/functional/result/impl/result-map-err.d.mts.map +0 -1
- package/dist/functional/result/impl/result-map-err.mjs +0 -22
- package/dist/functional/result/impl/result-map-err.mjs.map +0 -1
- package/dist/functional/result/impl/result-map.d.mts +0 -39
- package/dist/functional/result/impl/result-map.d.mts.map +0 -1
- package/dist/functional/result/impl/result-map.mjs +0 -22
- package/dist/functional/result/impl/result-map.mjs.map +0 -1
- package/dist/functional/result/impl/result-match.d.mts +0 -47
- package/dist/functional/result/impl/result-match.d.mts.map +0 -1
- package/dist/functional/result/impl/result-match.mjs +0 -20
- package/dist/functional/result/impl/result-match.mjs.map +0 -1
- package/dist/functional/result/impl/result-ok.d.mts +0 -28
- package/dist/functional/result/impl/result-ok.d.mts.map +0 -1
- package/dist/functional/result/impl/result-ok.mjs +0 -31
- package/dist/functional/result/impl/result-ok.mjs.map +0 -1
- package/dist/functional/result/impl/result-or-else.d.mts +0 -40
- package/dist/functional/result/impl/result-or-else.d.mts.map +0 -1
- package/dist/functional/result/impl/result-or-else.mjs +0 -17
- package/dist/functional/result/impl/result-or-else.mjs.map +0 -1
- package/dist/functional/result/impl/result-safe-try.d.mts +0 -51
- package/dist/functional/result/impl/result-safe-try.d.mts.map +0 -1
- package/dist/functional/result/impl/result-safe-try.mjs +0 -35
- package/dist/functional/result/impl/result-safe-try.mjs.map +0 -1
- package/dist/functional/result/impl/result-safe-unwrap.d.mts +0 -36
- package/dist/functional/result/impl/result-safe-unwrap.d.mts.map +0 -1
- package/dist/functional/result/impl/result-safe-unwrap.mjs +0 -42
- package/dist/functional/result/impl/result-safe-unwrap.mjs.map +0 -1
- package/dist/functional/result/impl/result-swap.d.mts +0 -23
- package/dist/functional/result/impl/result-swap.d.mts.map +0 -1
- package/dist/functional/result/impl/result-swap.mjs +0 -27
- package/dist/functional/result/impl/result-swap.mjs.map +0 -1
- package/dist/functional/result/impl/result-to-optional.d.mts +0 -32
- package/dist/functional/result/impl/result-to-optional.d.mts.map +0 -1
- package/dist/functional/result/impl/result-to-optional.mjs +0 -32
- package/dist/functional/result/impl/result-to-optional.mjs.map +0 -1
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts +0 -33
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +0 -1
- package/dist/functional/result/impl/result-unwrap-err-or.mjs +0 -17
- package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +0 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +0 -33
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +0 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs +0 -46
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +0 -1
- package/dist/functional/result/impl/result-unwrap-err.d.mts +0 -33
- package/dist/functional/result/impl/result-unwrap-err.d.mts.map +0 -1
- package/dist/functional/result/impl/result-unwrap-err.mjs +0 -34
- package/dist/functional/result/impl/result-unwrap-err.mjs.map +0 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +0 -33
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +0 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs +0 -17
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +0 -1
- package/dist/functional/result/impl/result-unwrap-ok.d.mts +0 -26
- package/dist/functional/result/impl/result-unwrap-ok.d.mts.map +0 -1
- package/dist/functional/result/impl/result-unwrap-ok.mjs +0 -8
- package/dist/functional/result/impl/result-unwrap-ok.mjs.map +0 -1
- package/dist/functional/result/impl/result-unwrap-throw.d.mts +0 -33
- package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +0 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs +0 -40
- package/dist/functional/result/impl/result-unwrap-throw.mjs.map +0 -1
- package/dist/functional/result/impl/result-zip.d.mts +0 -32
- package/dist/functional/result/impl/result-zip.d.mts.map +0 -1
- package/dist/functional/result/impl/result-zip.mjs +0 -37
- package/dist/functional/result/impl/result-zip.mjs.map +0 -1
- package/dist/functional/result/impl/tag.d.mts +0 -6
- package/dist/functional/result/impl/tag.d.mts.map +0 -1
- package/dist/functional/result/impl/tag.mjs +0 -4
- package/dist/functional/result/impl/tag.mjs.map +0 -1
- package/dist/functional/result/impl/types.d.mts +0 -31
- package/dist/functional/result/impl/types.d.mts.map +0 -1
- package/dist/functional/result/impl/types.mjs +0 -2
- package/dist/functional/result/impl/types.mjs.map +0 -1
- package/dist/functional/result/index.d.mts +0 -2
- package/dist/functional/result/index.d.mts.map +0 -1
- package/dist/functional/result/index.mjs +0 -2
- package/dist/functional/result/index.mjs.map +0 -1
- package/dist/functional/result/result.d.mts +0 -16
- package/dist/functional/result/result.d.mts.map +0 -1
- package/dist/functional/result/result.mjs +0 -2
- package/dist/functional/result/result.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/index.d.mts +0 -29
- package/dist/functional/ternary-result/impl/index.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/index.mjs +0 -29
- package/dist/functional/ternary-result/impl/index.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/tag.d.mts +0 -8
- package/dist/functional/ternary-result/impl/tag.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/tag.mjs +0 -6
- package/dist/functional/ternary-result/impl/tag.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +0 -16
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs +0 -19
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +0 -24
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs +0 -21
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +0 -39
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs +0 -38
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts +0 -30
- package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-fold.mjs +0 -33
- package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +0 -23
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +0 -23
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +0 -20
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +0 -33
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts +0 -21
- package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs +0 -20
- package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts +0 -23
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +0 -22
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +0 -22
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +0 -28
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts +0 -22
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +0 -21
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts +0 -27
- package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs +0 -23
- package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts +0 -28
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs +0 -26
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-map.d.mts +0 -36
- package/dist/functional/ternary-result/impl/ternary-result-map.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-map.mjs +0 -32
- package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts +0 -17
- package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs +0 -20
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +0 -29
- package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs +0 -16
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts +0 -23
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +0 -26
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +0 -28
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs +0 -14
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts +0 -20
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +0 -34
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts +0 -20
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +0 -21
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +0 -25
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs +0 -14
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts +0 -20
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs +0 -10
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts +0 -21
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +0 -35
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +0 -22
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs +0 -14
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts +0 -20
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +0 -30
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts +0 -20
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +0 -21
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts +0 -19
- package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs +0 -23
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts +0 -34
- package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +0 -52
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/types.d.mts +0 -26
- package/dist/functional/ternary-result/impl/types.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/types.mjs +0 -2
- package/dist/functional/ternary-result/impl/types.mjs.map +0 -1
- package/dist/functional/ternary-result/impl/variant-name.d.mts +0 -4
- package/dist/functional/ternary-result/impl/variant-name.d.mts.map +0 -1
- package/dist/functional/ternary-result/impl/variant-name.mjs +0 -13
- package/dist/functional/ternary-result/impl/variant-name.mjs.map +0 -1
- package/dist/functional/ternary-result/index.d.mts +0 -2
- package/dist/functional/ternary-result/index.d.mts.map +0 -1
- package/dist/functional/ternary-result/index.mjs +0 -2
- package/dist/functional/ternary-result/index.mjs.map +0 -1
- package/dist/functional/ternary-result/ternary-result.d.mts +0 -40
- package/dist/functional/ternary-result/ternary-result.d.mts.map +0 -1
- package/dist/functional/ternary-result/ternary-result.mjs +0 -2
- package/dist/functional/ternary-result/ternary-result.mjs.map +0 -1
- package/src/functional/async-result/async-result.mts +0 -17
- package/src/functional/async-result/impl/async-result-flat-map.mts +0 -99
- package/src/functional/async-result/impl/async-result-from-promise.mts +0 -69
- package/src/functional/async-result/impl/async-result-from-throwable.mts +0 -78
- package/src/functional/async-result/impl/async-result-map-err.mts +0 -84
- package/src/functional/async-result/impl/async-result-map.mts +0 -94
- package/src/functional/async-result/impl/async-result-unwrap-or.mts +0 -42
- package/src/functional/async-result/impl/index.mts +0 -7
- package/src/functional/async-result/impl/types.mts +0 -51
- package/src/functional/async-result/index.mts +0 -1
- package/src/functional/async-result.test.mts +0 -291
- package/src/functional/match.mts +0 -193
- package/src/functional/match.test.mts +0 -180
- package/src/functional/optional/impl/index.mts +0 -18
- package/src/functional/optional/impl/optional-expect-to-be.mts +0 -75
- package/src/functional/optional/impl/optional-filter.mts +0 -78
- package/src/functional/optional/impl/optional-flat-map.mts +0 -75
- package/src/functional/optional/impl/optional-from-nullable.mts +0 -31
- package/src/functional/optional/impl/optional-is-none.mts +0 -26
- package/src/functional/optional/impl/optional-is-optional.mts +0 -30
- package/src/functional/optional/impl/optional-is-some.mts +0 -27
- package/src/functional/optional/impl/optional-map.mts +0 -90
- package/src/functional/optional/impl/optional-match.mts +0 -108
- package/src/functional/optional/impl/optional-none.mts +0 -20
- package/src/functional/optional/impl/optional-or-else.mts +0 -83
- package/src/functional/optional/impl/optional-some.mts +0 -27
- package/src/functional/optional/impl/optional-to-nullable.mts +0 -34
- package/src/functional/optional/impl/optional-unwrap-or.mts +0 -70
- package/src/functional/optional/impl/optional-unwrap-throw.mts +0 -41
- package/src/functional/optional/impl/optional-unwrap.mts +0 -45
- package/src/functional/optional/impl/optional-zip.mts +0 -44
- package/src/functional/optional/impl/tag.mts +0 -8
- package/src/functional/optional/impl/types.mts +0 -31
- package/src/functional/optional/index.mts +0 -1
- package/src/functional/optional/optional.mts +0 -19
- package/src/functional/optional.test.mts +0 -883
- package/src/functional/pipe.mts +0 -180
- package/src/functional/pipe.test.mts +0 -155
- package/src/functional/result/impl/index.mts +0 -27
- package/src/functional/result/impl/result-err.mts +0 -33
- package/src/functional/result/impl/result-expect-to-be.mts +0 -73
- package/src/functional/result/impl/result-flat-map.mts +0 -88
- package/src/functional/result/impl/result-fold.mts +0 -102
- package/src/functional/result/impl/result-from-optional.mts +0 -80
- package/src/functional/result/impl/result-from-promise.mts +0 -51
- package/src/functional/result/impl/result-from-throwable.mts +0 -48
- package/src/functional/result/impl/result-is-err.mts +0 -26
- package/src/functional/result/impl/result-is-ok.mts +0 -26
- package/src/functional/result/impl/result-is-result.mts +0 -28
- package/src/functional/result/impl/result-map-err.mts +0 -96
- package/src/functional/result/impl/result-map.mts +0 -96
- package/src/functional/result/impl/result-match.mts +0 -108
- package/src/functional/result/impl/result-ok.mts +0 -33
- package/src/functional/result/impl/result-or-else.mts +0 -73
- package/src/functional/result/impl/result-safe-try.mts +0 -110
- package/src/functional/result/impl/result-safe-unwrap.mts +0 -50
- package/src/functional/result/impl/result-swap.mts +0 -31
- package/src/functional/result/impl/result-to-optional.mts +0 -37
- package/src/functional/result/impl/result-unwrap-err-or.mts +0 -66
- package/src/functional/result/impl/result-unwrap-err-throw.mts +0 -56
- package/src/functional/result/impl/result-unwrap-err.mts +0 -38
- package/src/functional/result/impl/result-unwrap-ok-or.mts +0 -66
- package/src/functional/result/impl/result-unwrap-ok.mts +0 -39
- package/src/functional/result/impl/result-unwrap-throw.mts +0 -46
- package/src/functional/result/impl/result-zip.mts +0 -42
- package/src/functional/result/impl/tag.mts +0 -8
- package/src/functional/result/impl/types.mts +0 -38
- package/src/functional/result/index.mts +0 -1
- package/src/functional/result/result.mts +0 -19
- package/src/functional/result.test.mts +0 -1349
- package/src/functional/ternary-result/impl/index.mts +0 -28
- package/src/functional/ternary-result/impl/tag.mts +0 -17
- package/src/functional/ternary-result/impl/ternary-result-err.mts +0 -21
- package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +0 -65
- package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +0 -112
- package/src/functional/ternary-result/impl/ternary-result-fold.mts +0 -102
- package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +0 -30
- package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +0 -36
- package/src/functional/ternary-result/impl/ternary-result-is-err.mts +0 -24
- package/src/functional/ternary-result/impl/ternary-result-is-ok.mts +0 -26
- package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +0 -32
- package/src/functional/ternary-result/impl/ternary-result-is-warn.mts +0 -25
- package/src/functional/ternary-result/impl/ternary-result-map-err.mts +0 -74
- package/src/functional/ternary-result/impl/ternary-result-map-warn.mts +0 -79
- package/src/functional/ternary-result/impl/ternary-result-map.mts +0 -95
- package/src/functional/ternary-result/impl/ternary-result-ok.mts +0 -22
- package/src/functional/ternary-result/impl/ternary-result-or-else.mts +0 -72
- package/src/functional/ternary-result/impl/ternary-result-to-optional.mts +0 -31
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +0 -54
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts +0 -42
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err.mts +0 -25
- package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +0 -51
- package/src/functional/ternary-result/impl/ternary-result-unwrap-ok.mts +0 -39
- package/src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts +0 -48
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +0 -48
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts +0 -40
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts +0 -25
- package/src/functional/ternary-result/impl/ternary-result-warn.mts +0 -28
- package/src/functional/ternary-result/impl/ternary-result-zip.mts +0 -61
- package/src/functional/ternary-result/impl/types.mts +0 -46
- package/src/functional/ternary-result/impl/variant-name.mts +0 -18
- package/src/functional/ternary-result/index.mts +0 -1
- package/src/functional/ternary-result/ternary-result.mts +0 -50
- package/src/functional/ternary-result.test.mts +0 -310
- package/src/guard/has-key.test.mts +0 -111
- package/src/guard/is-non-null-object.test.mts +0 -109
- package/src/guard/is-record.test.mts +0 -195
- package/src/guard/key-is-in.test.mts +0 -21
- package/src/others/unknown-to-string.test.mts +0 -295
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-ok.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-ok.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AA6B1C,MAAM,UAAU,QAAQ,CACtB,MAAS;IAET,OAAO,IAAI,CAAC,MAAM,CAAC;QACjB,CAAC,CAAC,oEAAoE;YACnE,MAAM,CAAC,KAAqB;QAC/B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { type UnknownResult } from '../result.mjs';
|
|
2
|
-
import { type UnwrapErr, type UnwrapOk } from './types.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Unwraps a `Result`, returning the success value. Throws an error if the
|
|
5
|
-
* `Result` is `Result.Err`.
|
|
6
|
-
*
|
|
7
|
-
* This is useful when you're confident that a Result should contain a success
|
|
8
|
-
* value and want to treat errors as exceptional conditions. The error message
|
|
9
|
-
* will be constructed from the error value using the provided string
|
|
10
|
-
* conversion function.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* const okResult = Result.ok('data');
|
|
16
|
-
*
|
|
17
|
-
* const errResult = Result.err(new Error('fail'));
|
|
18
|
-
*
|
|
19
|
-
* assert.isTrue(Result.unwrapThrow(okResult) === 'data');
|
|
20
|
-
*
|
|
21
|
-
* assert.throws(() => Result.unwrapThrow(errResult), Error, 'fail');
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @template R The `UnknownResult` type to unwrap.
|
|
25
|
-
* @param result The `Result` to unwrap.
|
|
26
|
-
* @param toStr An optional function to convert the error value to a string
|
|
27
|
-
* for the error message. Defaults to `String`.
|
|
28
|
-
* @returns The success value if `Result.Ok`.
|
|
29
|
-
* @throws {Error} Error with the stringified error value if the `Result` is
|
|
30
|
-
* `Result.Err`.
|
|
31
|
-
*/
|
|
32
|
-
export declare const unwrapThrow: <R extends UnknownResult>(result: R, toStr?: (e: UnwrapErr<R>) => string) => UnwrapOk<R>;
|
|
33
|
-
//# sourceMappingURL=result-unwrap-throw.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-throw.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-throw.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,aAAa,UACzC,CAAC,UACF,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,KACjC,QAAQ,CAAC,CAAC,CAQZ,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { unknownToString } from '../../../others/index.mjs';
|
|
2
|
-
import { isErr } from './result-is-err.mjs';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export const unwrapThrow = (result, toStr = unknownToString) => {
|
|
33
|
-
if (isErr(result)) {
|
|
34
|
-
|
|
35
|
-
throw new Error(toStr(result.value));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return result.value;
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=result-unwrap-throw.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-throw.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-throw.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,MAAS,EACT,KAAK,GAAgC,eAAe,EACvC,EAAE;IACf,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,oEAAoE;QACpE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,oEAAoE;IACpE,OAAO,MAAM,CAAC,KAAoB,CAAC;AACrC,CAAC,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../result.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Combines two `Result` values into a single `Result` containing a tuple. If
|
|
4
|
-
* either `Result` is `Err`, returns the first `Err` encountered.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const first = Result.ok('left');
|
|
10
|
-
*
|
|
11
|
-
* const second = Result.ok(1);
|
|
12
|
-
*
|
|
13
|
-
* const expected = ['left', 1] as const;
|
|
14
|
-
*
|
|
15
|
-
* assert.deepStrictEqual(Result.zip(first, second), Result.ok(expected));
|
|
16
|
-
*
|
|
17
|
-
* assert.deepStrictEqual(
|
|
18
|
-
* Result.zip(first, Result.err('error')),
|
|
19
|
-
* Result.err('error'),
|
|
20
|
-
* );
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @template S1 The success type of the first `Result`.
|
|
24
|
-
* @template E1 The error type of the first `Result`.
|
|
25
|
-
* @template S2 The success type of the second `Result`.
|
|
26
|
-
* @template E2 The error type of the second `Result`.
|
|
27
|
-
* @param resultA The first `Result`.
|
|
28
|
-
* @param resultB The second `Result`.
|
|
29
|
-
* @returns A `Result` containing a tuple of both values, or the first `Err`.
|
|
30
|
-
*/
|
|
31
|
-
export declare const zip: <S1, E1, S2, E2>(resultA: Result<S1, E1>, resultB: Result<S2, E2>) => Result<readonly [S1, S2], E1 | E2>;
|
|
32
|
-
//# sourceMappingURL=result-zip.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result-zip.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-zip.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,GAAG,GAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,WACvB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,WACd,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,KACtB,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAKvB,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { isOk } from './result-is-ok.mjs';
|
|
2
|
-
import { ok } from './result-ok.mjs';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export const zip = (resultA, resultB) => isOk(resultA)
|
|
33
|
-
? isOk(resultB)
|
|
34
|
-
? ok([resultA.value, resultB.value])
|
|
35
|
-
: resultB
|
|
36
|
-
: resultA;
|
|
37
|
-
//# sourceMappingURL=result-zip.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result-zip.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-zip.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,OAAuB,EACvB,OAAuB,EACa,EAAE,CACtC,IAAI,CAAC,OAAO,CAAC;IACX,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACb,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAU,CAAC;QAC7C,CAAC,CAAC,OAAO;IACX,CAAC,CAAC,OAAO,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** @internal Tag identifying the Ok variant. */
|
|
2
|
-
import { type Err, type Ok } from '../../../types.mjs';
|
|
3
|
-
export declare const OkTypeTagName: Ok<unknown>['$$tag'];
|
|
4
|
-
/** @internal Tag identifying the Err variant. */
|
|
5
|
-
export declare const ErrTypeTagName: Err<unknown>['$$tag'];
|
|
6
|
-
//# sourceMappingURL=tag.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/tag.mts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,CAA8B,CAAC;AAE9E,iDAAiD;AACjD,eAAO,MAAM,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CACpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tag.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/tag.mts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,aAAa,GAAyB,0BAA0B,CAAC;AAE9E,iDAAiD;AACjD,MAAM,CAAC,MAAM,cAAc,GACzB,2BAA2B,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type Err, type Ok } from '../../../types.mjs';
|
|
2
|
-
import { type UnknownResult } from '../result.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Extracts the success value type `S` from a `Result.Ok<S>`. If the `Result`
|
|
5
|
-
* is `Result.Err<E>`, resolves to `never`.
|
|
6
|
-
*
|
|
7
|
-
* @template R The `UnknownResult` type to unwrap.
|
|
8
|
-
*/
|
|
9
|
-
export type UnwrapOk<R extends UnknownResult> = R extends Ok<infer S> ? S : never;
|
|
10
|
-
/**
|
|
11
|
-
* Extracts the error value type `E` from a `Result.Err<E>`. If the `Result`
|
|
12
|
-
* is `Result.Ok<S>`, resolves to `never`.
|
|
13
|
-
*
|
|
14
|
-
* @template R The `UnknownResult` type to unwrap.
|
|
15
|
-
*/
|
|
16
|
-
export type UnwrapErr<R extends UnknownResult> = R extends Err<infer E> ? E : never;
|
|
17
|
-
/**
|
|
18
|
-
* Narrows a `UnknownResult` type to `Result.Ok<S>` if it is an `Ok`. If the
|
|
19
|
-
* `Result` is `Result.Err<E>`, resolves to `never`.
|
|
20
|
-
*
|
|
21
|
-
* @template R The `UnknownResult` type to narrow.
|
|
22
|
-
*/
|
|
23
|
-
export type NarrowToOk<R extends UnknownResult> = R extends Ok<unknown> ? R : never;
|
|
24
|
-
/**
|
|
25
|
-
* Narrows a `UnknownResult` type to `Result.Err<E>` if it is an `Err`. If the
|
|
26
|
-
* `Result` is `Result.Ok<S>`, resolves to `never`.
|
|
27
|
-
*
|
|
28
|
-
* @template R The `UnknownResult` type to narrow.
|
|
29
|
-
*/
|
|
30
|
-
export type NarrowToErr<R extends UnknownResult> = R extends Err<unknown> ? R : never;
|
|
31
|
-
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/types.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,aAAa,IAC1C,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,aAAa,IAC3C,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAErC;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,aAAa,IAC5C,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,aAAa,IAC7C,CAAC,SAAS,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/types.mts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/functional/result/index.mts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/functional/result/index.mts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type Err, type Ok } from '../../types.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a value that can either be a success (`Ok`) or an error (`Err`).
|
|
4
|
-
*
|
|
5
|
-
* @template S The type of the success value.
|
|
6
|
-
* @template E The type of the error value.
|
|
7
|
-
*/
|
|
8
|
-
export type Result<S, E> = Ok<S> | Err<E>;
|
|
9
|
-
/**
|
|
10
|
-
* Base type for any `Result`, used for generic constraints. Represents a
|
|
11
|
-
* `Result` with unknown success and error types.
|
|
12
|
-
*/
|
|
13
|
-
export type UnknownResult = Ok<unknown> | Err<unknown>;
|
|
14
|
-
export type { Err, Ok } from '../../types.mjs';
|
|
15
|
-
export * as Result from './impl/index.mjs';
|
|
16
|
-
//# sourceMappingURL=result.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.mts","sourceRoot":"","sources":["../../../src/functional/result/result.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;AAEvD,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result.mjs","sourceRoot":"","sources":["../../../src/functional/result/result.mts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export * from './ternary-result-err.mjs';
|
|
2
|
-
export * from './ternary-result-expect-to-be.mjs';
|
|
3
|
-
export * from './ternary-result-flat-map.mjs';
|
|
4
|
-
export * from './ternary-result-fold.mjs';
|
|
5
|
-
export * from './ternary-result-from-promise.mjs';
|
|
6
|
-
export * from './ternary-result-from-throwable.mjs';
|
|
7
|
-
export * from './ternary-result-is-err.mjs';
|
|
8
|
-
export * from './ternary-result-is-ok.mjs';
|
|
9
|
-
export * from './ternary-result-is-ternary-result.mjs';
|
|
10
|
-
export * from './ternary-result-is-warn.mjs';
|
|
11
|
-
export * from './ternary-result-map-err.mjs';
|
|
12
|
-
export * from './ternary-result-map-warn.mjs';
|
|
13
|
-
export * from './ternary-result-map.mjs';
|
|
14
|
-
export * from './ternary-result-ok.mjs';
|
|
15
|
-
export * from './ternary-result-or-else.mjs';
|
|
16
|
-
export * from './ternary-result-to-optional.mjs';
|
|
17
|
-
export * from './ternary-result-unwrap-err-or.mjs';
|
|
18
|
-
export * from './ternary-result-unwrap-err-throw.mjs';
|
|
19
|
-
export * from './ternary-result-unwrap-err.mjs';
|
|
20
|
-
export * from './ternary-result-unwrap-ok-or.mjs';
|
|
21
|
-
export * from './ternary-result-unwrap-ok.mjs';
|
|
22
|
-
export * from './ternary-result-unwrap-throw.mjs';
|
|
23
|
-
export * from './ternary-result-unwrap-warn-or.mjs';
|
|
24
|
-
export * from './ternary-result-unwrap-warn-throw.mjs';
|
|
25
|
-
export * from './ternary-result-unwrap-warn.mjs';
|
|
26
|
-
export * from './ternary-result-warn.mjs';
|
|
27
|
-
export * from './ternary-result-zip.mjs';
|
|
28
|
-
export * from './types.mjs';
|
|
29
|
-
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/index.mts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export * from './ternary-result-err.mjs';
|
|
2
|
-
export * from './ternary-result-expect-to-be.mjs';
|
|
3
|
-
export * from './ternary-result-flat-map.mjs';
|
|
4
|
-
export * from './ternary-result-fold.mjs';
|
|
5
|
-
export * from './ternary-result-from-promise.mjs';
|
|
6
|
-
export * from './ternary-result-from-throwable.mjs';
|
|
7
|
-
export * from './ternary-result-is-err.mjs';
|
|
8
|
-
export * from './ternary-result-is-ok.mjs';
|
|
9
|
-
export * from './ternary-result-is-ternary-result.mjs';
|
|
10
|
-
export * from './ternary-result-is-warn.mjs';
|
|
11
|
-
export * from './ternary-result-map-err.mjs';
|
|
12
|
-
export * from './ternary-result-map-warn.mjs';
|
|
13
|
-
export * from './ternary-result-map.mjs';
|
|
14
|
-
export * from './ternary-result-ok.mjs';
|
|
15
|
-
export * from './ternary-result-or-else.mjs';
|
|
16
|
-
export * from './ternary-result-to-optional.mjs';
|
|
17
|
-
export * from './ternary-result-unwrap-err-or.mjs';
|
|
18
|
-
export * from './ternary-result-unwrap-err-throw.mjs';
|
|
19
|
-
export * from './ternary-result-unwrap-err.mjs';
|
|
20
|
-
export * from './ternary-result-unwrap-ok-or.mjs';
|
|
21
|
-
export * from './ternary-result-unwrap-ok.mjs';
|
|
22
|
-
export * from './ternary-result-unwrap-throw.mjs';
|
|
23
|
-
export * from './ternary-result-unwrap-warn-or.mjs';
|
|
24
|
-
export * from './ternary-result-unwrap-warn-throw.mjs';
|
|
25
|
-
export * from './ternary-result-unwrap-warn.mjs';
|
|
26
|
-
export * from './ternary-result-warn.mjs';
|
|
27
|
-
export * from './ternary-result-zip.mjs';
|
|
28
|
-
export * from './types.mjs';
|
|
29
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/index.mts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** @internal Tag identifying the Ok variant. */
|
|
2
|
-
import { type TernaryErr, type TernaryOk, type TernaryWarn } from '../ternary-result.mjs';
|
|
3
|
-
export declare const OkTypeTagName: TernaryOk<unknown>['$$tag'];
|
|
4
|
-
/** @internal Tag identifying the Warn variant. */
|
|
5
|
-
export declare const WarnTypeTagName: TernaryWarn<unknown, unknown>['$$tag'];
|
|
6
|
-
/** @internal Tag identifying the Err variant. */
|
|
7
|
-
export declare const ErrTypeTagName: TernaryErr<unknown>['$$tag'];
|
|
8
|
-
//# sourceMappingURL=tag.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/tag.mts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAC1B,CAAC;AAE7B,kDAAkD;AAClD,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,CACrC,CAAC;AAE/B,iDAAiD;AACjD,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAC3B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tag.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/tag.mts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,aAAa,GACxB,0BAA0B,CAAC;AAE7B,kDAAkD;AAClD,MAAM,CAAC,MAAM,eAAe,GAC1B,4BAA4B,CAAC;AAE/B,iDAAiD;AACjD,MAAM,CAAC,MAAM,cAAc,GACzB,2BAA2B,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type TernaryErr } from '../ternary-result.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a `TernaryResult.Err` containing the provided error value.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* const failure = TernaryResult.err(new Error('missing data'));
|
|
9
|
-
*
|
|
10
|
-
* assert.strictEqual(failure.$$tag, 'ts-data-forge::Result.err');
|
|
11
|
-
*
|
|
12
|
-
* assert.isTrue(TernaryResult.isErr(failure));
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare const err: <const E>(value: E) => TernaryErr<E>;
|
|
16
|
-
//# sourceMappingURL=ternary-result-err.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-err.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,GAAG,GAAI,KAAK,CAAC,CAAC,SAAU,CAAC,KAAG,UAAU,CAAC,CAAC,CAIxC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-err.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-err.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAW,KAAQ,EAAiB,EAAE,CACvD,CAAC;IACC,KAAK,EAAE,cAAc;IACrB,KAAK;CACN,CAAU,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type TernaryResult, type UnknownTernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
import { type UnwrapOk } from './types.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Unwraps the Ok value or throws with the provided message.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const okValue = TernaryResult.ok('ready');
|
|
10
|
-
*
|
|
11
|
-
* assert.strictEqual(TernaryResult.expectToBe(okValue, 'missing'), 'ready');
|
|
12
|
-
*
|
|
13
|
-
* const expectResult = TernaryResult.expectToBe('needs value');
|
|
14
|
-
*
|
|
15
|
-
* const throwTest = (): void => {
|
|
16
|
-
* expectResult(TernaryResult.err('oops'));
|
|
17
|
-
* };
|
|
18
|
-
*
|
|
19
|
-
* assert.throws(throwTest, /needs value/u);
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function expectToBe<R extends UnknownTernaryResult>(result: R, message: string): UnwrapOk<R>;
|
|
23
|
-
export declare function expectToBe(message: string): <S, W, E>(result: TernaryResult<S, E, W>) => S;
|
|
24
|
-
//# sourceMappingURL=ternary-result-expect-to-be.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-expect-to-be.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-expect-to-be.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,oBAAoB,EACvD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,MAAM,GACd,QAAQ,CAAC,CAAC,CAAC,CAAC;AAGf,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,GACd,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { isOk } from './ternary-result-is-ok.mjs';
|
|
2
|
-
import { unwrapOk } from './ternary-result-unwrap-ok.mjs';
|
|
3
|
-
export function expectToBe(...args) {
|
|
4
|
-
switch (args.length) {
|
|
5
|
-
case 2: {
|
|
6
|
-
const [result, message] = args;
|
|
7
|
-
return expectImpl(result, message);
|
|
8
|
-
}
|
|
9
|
-
case 1: {
|
|
10
|
-
const [message] = args;
|
|
11
|
-
return (result) => expectImpl(result, message);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const expectImpl = (result, message) => {
|
|
16
|
-
if (isOk(result)) {
|
|
17
|
-
return unwrapOk(result);
|
|
18
|
-
}
|
|
19
|
-
throw new Error(message);
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=ternary-result-expect-to-be.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-expect-to-be.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-expect-to-be.mts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAgC1D,MAAM,UAAU,UAAU,CACxB,GAAG,IAAwE;IAE3E,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;YAE/B,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;YAEvB,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,CACjB,MAAS,EACT,OAAe,EACF,EAAE;IACf,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { type TernaryResult, type UnknownTernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
import { type UnwrapErr, type UnwrapOk, type UnwrapWarn } from './types.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Applies a function returning a `TernaryResult` to the Ok variant.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const parse = (value: string): TernaryResult<number, string, string> =>
|
|
10
|
-
* pipe(Num.safeParseFloat(value)).map((result) =>
|
|
11
|
-
* Result.isErr(result)
|
|
12
|
-
* ? TernaryResult.err('NaN')
|
|
13
|
-
* : TernaryResult.ok(result.value),
|
|
14
|
-
* ).value;
|
|
15
|
-
*
|
|
16
|
-
* const doubled = TernaryResult.flatMap(TernaryResult.ok('3'), (text) =>
|
|
17
|
-
* TernaryResult.map(parse(text), (num) => num * 2),
|
|
18
|
-
* );
|
|
19
|
-
*
|
|
20
|
-
* const warnPassthrough = TernaryResult.flatMap(
|
|
21
|
-
* TernaryResult.warn('3', 'retry'),
|
|
22
|
-
* parse,
|
|
23
|
-
* );
|
|
24
|
-
*
|
|
25
|
-
* const errPassthrough = TernaryResult.flatMap(
|
|
26
|
-
* TernaryResult.err('oops'),
|
|
27
|
-
* parse,
|
|
28
|
-
* );
|
|
29
|
-
*
|
|
30
|
-
* assert.deepStrictEqual(doubled, TernaryResult.ok(6));
|
|
31
|
-
*
|
|
32
|
-
* assert.deepStrictEqual(warnPassthrough, TernaryResult.warn(3, 'retry'));
|
|
33
|
-
*
|
|
34
|
-
* assert.deepStrictEqual(errPassthrough, TernaryResult.err('oops'));
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function flatMap<R extends UnknownTernaryResult, S2, W2, E2>(result: R, flatMapFn: (value: UnwrapOk<R>) => TernaryResult<S2, E2, W2>): TernaryResult<S2, E2 | UnwrapErr<R>, W2 | UnwrapWarn<R>>;
|
|
38
|
-
export declare function flatMap<S, S2, W2, E2>(flatMapFn: (value: S) => TernaryResult<S2, E2, W2>): <W, E>(result: TernaryResult<S, E, W>) => TernaryResult<S2, E | E2, W | W2>;
|
|
39
|
-
//# sourceMappingURL=ternary-result-flat-map.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-flat-map.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-flat-map.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,oBAAoB,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAChE,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAC3D,aAAa,CAAC,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAG5D,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EACnC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GACjD,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { isOk } from './ternary-result-is-ok.mjs';
|
|
2
|
-
import { isWarn } from './ternary-result-is-warn.mjs';
|
|
3
|
-
import { warn } from './ternary-result-warn.mjs';
|
|
4
|
-
export function flatMap(...args) {
|
|
5
|
-
switch (args.length) {
|
|
6
|
-
case 2: {
|
|
7
|
-
const [result, flatMapFn] = args;
|
|
8
|
-
return flatMapImpl(result, flatMapFn);
|
|
9
|
-
}
|
|
10
|
-
case 1: {
|
|
11
|
-
const [flatMapFn] = args;
|
|
12
|
-
return (result) => flatMapImpl(result, flatMapFn);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const flatMapImpl = (result, flatMapFn) => {
|
|
17
|
-
if (isOk(result)) {
|
|
18
|
-
|
|
19
|
-
return flatMapFn(result.value);
|
|
20
|
-
}
|
|
21
|
-
if (isWarn(result)) {
|
|
22
|
-
const next = flatMapFn(
|
|
23
|
-
|
|
24
|
-
result.value);
|
|
25
|
-
if (isOk(next)) {
|
|
26
|
-
return warn(next.value,
|
|
27
|
-
|
|
28
|
-
result.warning);
|
|
29
|
-
}
|
|
30
|
-
if (isWarn(next)) {
|
|
31
|
-
return warn(next.value, next.warning);
|
|
32
|
-
}
|
|
33
|
-
return next;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=ternary-result-flat-map.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-flat-map.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-flat-map.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AA+CjD,MAAM,UAAU,OAAO,CACrB,GAAG,IAKwE;IAI3E,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;YAEjC,OAAO,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACxC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;YAEzB,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAG,CAClB,MAAS,EACT,SAA4D,EACF,EAAE;IAC5D,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjB,oEAAoE;QACpE,OAAO,SAAS,CAAC,MAAM,CAAC,KAAoB,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,SAAS;QACpB,oEAAoE;QACpE,MAAM,CAAC,KAAoB,CAC5B,CAAC;QAEF,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACf,OAAO,IAAI,CACT,IAAI,CAAC,KAAK;YACV,oEAAoE;YACpE,MAAM,CAAC,OAAwB,CAChC,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAoC,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oEAAoE;IACpE,OAAO,MAAuC,CAAC;AACjD,CAAC,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type TernaryResult, type UnknownTernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
import { type UnwrapErr, type UnwrapOk, type UnwrapWarn } from './types.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Applies the provided mapper based on the current variant.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const okFold = TernaryResult.fold(
|
|
10
|
-
* TernaryResult.ok(2),
|
|
11
|
-
* (value) => value * 2,
|
|
12
|
-
* (warn: string) => warn.length,
|
|
13
|
-
* (error: string) => error.toUpperCase(),
|
|
14
|
-
* );
|
|
15
|
-
*
|
|
16
|
-
* const warnFold = TernaryResult.fold(
|
|
17
|
-
* TernaryResult.warn(2, 'spike'),
|
|
18
|
-
* (value: number) => value,
|
|
19
|
-
* (warn: string) => warn.toUpperCase(),
|
|
20
|
-
* (error: string) => error,
|
|
21
|
-
* );
|
|
22
|
-
*
|
|
23
|
-
* assert.deepStrictEqual(okFold, TernaryResult.ok(4));
|
|
24
|
-
*
|
|
25
|
-
* assert.deepStrictEqual(warnFold, TernaryResult.warn(2, 'SPIKE'));
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function fold<R extends UnknownTernaryResult, S2, W2, E2>(result: R, mapOk: (value: UnwrapOk<R>) => S2, mapWarn: (value: UnwrapWarn<R>) => W2, mapErr: (error: UnwrapErr<R>) => E2): TernaryResult<S2, E2, W2>;
|
|
29
|
-
export declare function fold<S, W, E, S2, W2, E2>(mapOk: (value: S) => S2, mapWarn: (value: W) => W2, mapErr: (error: E) => E2): (result: TernaryResult<S, E, W>) => TernaryResult<S2, E2, W2>;
|
|
30
|
-
//# sourceMappingURL=ternary-result-fold.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-fold.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-fold.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,oBAAoB,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC7D,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,EACjC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,EACrC,MAAM,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,GAClC,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAG7B,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EACtC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EACvB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EACzB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GACvB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { err } from './ternary-result-err.mjs';
|
|
2
|
-
import { isOk } from './ternary-result-is-ok.mjs';
|
|
3
|
-
import { isWarn } from './ternary-result-is-warn.mjs';
|
|
4
|
-
import { ok } from './ternary-result-ok.mjs';
|
|
5
|
-
import { warn } from './ternary-result-warn.mjs';
|
|
6
|
-
export function fold(...args) {
|
|
7
|
-
switch (args.length) {
|
|
8
|
-
case 4: {
|
|
9
|
-
const [result, mapOk, mapWarn, mapErr] = args;
|
|
10
|
-
return foldImpl(result, mapOk, mapWarn, mapErr);
|
|
11
|
-
}
|
|
12
|
-
case 3: {
|
|
13
|
-
const [mapOk, mapWarn, mapErr] = args;
|
|
14
|
-
return (result) => foldImpl(result, mapOk, mapWarn, mapErr);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const foldImpl = (result, mapOk, mapWarnFn, mapErrFn) => {
|
|
19
|
-
if (isOk(result)) {
|
|
20
|
-
|
|
21
|
-
return ok(mapOk(result.value));
|
|
22
|
-
}
|
|
23
|
-
if (isWarn(result)) {
|
|
24
|
-
return warn(
|
|
25
|
-
|
|
26
|
-
mapOk(result.value),
|
|
27
|
-
|
|
28
|
-
mapWarnFn(result.warning));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return err(mapErrFn(result.value));
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=ternary-result-fold.mjs.map
|