ts-data-forge 14.6.4 → 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/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 +5 -5
- 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":"ternary-result-fold.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-fold.mts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AA0CjD,MAAM,UAAU,IAAI,CAClB,GAAG,IAWE;IAEL,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;YAE9C,OAAO,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;YAEtC,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,QAAQ,GAAG,CACf,MAAS,EACT,KAAiC,EACjC,SAAyC,EACzC,QAAqC,EACV,EAAE;IAC7B,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjB,oEAAoE;QACpE,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAoB,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI;QACT,oEAAoE;QACpE,KAAK,CAAC,MAAM,CAAC,KAAoB,CAAC;QAClC,oEAAoE;QACpE,SAAS,CAAC,MAAM,CAAC,OAAwB,CAAC,CAC3C,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type TernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
/** @internal Utility type extracting the resolved value from a Promise. */
|
|
3
|
-
type UnwrapPromise<P extends Promise<unknown>> = P extends Promise<infer V> ? V : never;
|
|
4
|
-
/**
|
|
5
|
-
* Converts a Promise into a Promise that resolves to a `TernaryResult`.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* const resolved = await TernaryResult.fromPromise(Promise.resolve('ok'));
|
|
11
|
-
*
|
|
12
|
-
* const rejected = await TernaryResult.fromPromise(
|
|
13
|
-
* Promise.reject(new Error('fail')),
|
|
14
|
-
* );
|
|
15
|
-
*
|
|
16
|
-
* assert.deepStrictEqual(resolved, TernaryResult.ok('ok'));
|
|
17
|
-
*
|
|
18
|
-
* assert.isTrue(TernaryResult.isErr(rejected));
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare const fromPromise: <P extends Promise<unknown>>(promise: P) => Promise<TernaryResult<UnwrapPromise<P>, unknown, never>>;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=ternary-result-from-promise.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-from-promise.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-from-promise.mts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3E,2EAA2E;AAC3E,KAAK,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,IAC3C,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,WAC3C,CAAC,KACT,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAEoB,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { err } from './ternary-result-err.mjs';
|
|
2
|
-
import { ok } from './ternary-result-ok.mjs';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export const fromPromise = (promise) =>
|
|
21
|
-
|
|
22
|
-
promise.then((value) => ok(value)).catch(err);
|
|
23
|
-
//# sourceMappingURL=ternary-result-from-promise.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-from-promise.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-from-promise.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAM7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAAU,EACgD,EAAE;AAC5D,oEAAoE;AACpE,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAgC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type TernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Wraps a potentially-throwing function in a `TernaryResult`.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* const success = TernaryResult.fromThrowable(() => 1 + 1);
|
|
9
|
-
*
|
|
10
|
-
* const failure = TernaryResult.fromThrowable(() => {
|
|
11
|
-
* throw new Error('boom');
|
|
12
|
-
* });
|
|
13
|
-
*
|
|
14
|
-
* assert.deepStrictEqual(success, TernaryResult.ok(2));
|
|
15
|
-
*
|
|
16
|
-
* assert.isTrue(TernaryResult.isErr(failure));
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare const fromThrowable: <T>(fn: () => T) => TernaryResult<T, Error, never>;
|
|
20
|
-
//# sourceMappingURL=ternary-result-from-throwable.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-from-throwable.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-from-throwable.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,MACzB,MAAM,CAAC,KACV,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAU/B,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { isError } from '@sindresorhus/is';
|
|
2
|
-
import { unknownToString } from '../../../others/index.mjs';
|
|
3
|
-
import { err } from './ternary-result-err.mjs';
|
|
4
|
-
import { ok } from './ternary-result-ok.mjs';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export const fromThrowable = (fn) => {
|
|
23
|
-
try {
|
|
24
|
-
return ok(fn());
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
if (isError(error)) {
|
|
28
|
-
return err(error);
|
|
29
|
-
}
|
|
30
|
-
return err(new Error(unknownToString(error)));
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=ternary-result-from-throwable.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-from-throwable.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-from-throwable.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,EAAW,EACqB,EAAE;IAClC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACnB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type UnknownTernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
import { type NarrowToErr } from './types.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Type guard for the Err variant.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const maybeErr = TernaryResult.err('boom') as TernaryResult<
|
|
10
|
-
* number,
|
|
11
|
-
* string,
|
|
12
|
-
* string
|
|
13
|
-
* >;
|
|
14
|
-
*
|
|
15
|
-
* if (TernaryResult.isErr(maybeErr)) {
|
|
16
|
-
* assert.strictEqual(maybeErr.value, 'boom');
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare const isErr: <R extends UnknownTernaryResult>(result: R) => result is NarrowToErr<R>;
|
|
21
|
-
//# sourceMappingURL=ternary-result-is-err.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-is-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-is-err.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,oBAAoB,UAC1C,CAAC,KACR,MAAM,IAAI,WAAW,CAAC,CAAC,CAAoC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-is-err.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-is-err.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,MAAS,EACiB,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,cAAc,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type UnknownTernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
import { type NarrowToOk } from './types.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Type guard for the Ok variant.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const maybeNumber = TernaryResult.ok(42) as TernaryResult<
|
|
10
|
-
* number,
|
|
11
|
-
* string,
|
|
12
|
-
* string
|
|
13
|
-
* >;
|
|
14
|
-
*
|
|
15
|
-
* if (TernaryResult.isOk(maybeNumber)) {
|
|
16
|
-
* const value: number = maybeNumber.value;
|
|
17
|
-
*
|
|
18
|
-
* assert.strictEqual(value, 42);
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare const isOk: <R extends UnknownTernaryResult>(result: R) => result is NarrowToOk<R>;
|
|
23
|
-
//# sourceMappingURL=ternary-result-is-ok.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-is-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-is-ok.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,oBAAoB,UACzC,CAAC,KACR,MAAM,IAAI,UAAU,CAAC,CAAC,CAAmC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-is-ok.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-is-ok.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAS,EACgB,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,aAAa,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type UnknownTernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Checks whether the provided value is a {@link TernaryResult}.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* const okValue = TernaryResult.ok('done');
|
|
9
|
-
*
|
|
10
|
-
* const warnValue = TernaryResult.warn('done', 'retry later');
|
|
11
|
-
*
|
|
12
|
-
* const notResult = { $$tag: 'ts-data-forge::Result.ok' } as const;
|
|
13
|
-
*
|
|
14
|
-
* assert.isTrue(TernaryResult.isTernaryResult(okValue));
|
|
15
|
-
*
|
|
16
|
-
* assert.isTrue(TernaryResult.isTernaryResult(warnValue));
|
|
17
|
-
*
|
|
18
|
-
* assert.isFalse(TernaryResult.isTernaryResult(notResult));
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare const isTernaryResult: (maybeResult: unknown) => maybeResult is UnknownTernaryResult;
|
|
22
|
-
//# sourceMappingURL=ternary-result-is-ternary-result.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-is-ternary-result.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,gBACb,OAAO,KACnB,WAAW,IAAI,oBAMuB,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { hasKey, isRecord } from '../../../guard/index.mjs';
|
|
2
|
-
import { ErrTypeTagName, OkTypeTagName, WarnTypeTagName } from './tag.mjs';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export const isTernaryResult = (maybeResult) => isRecord(maybeResult) &&
|
|
23
|
-
hasKey(maybeResult, '$$tag') &&
|
|
24
|
-
hasKey(maybeResult, 'value') &&
|
|
25
|
-
((maybeResult.$$tag === WarnTypeTagName && hasKey(maybeResult, 'warning')) ||
|
|
26
|
-
maybeResult.$$tag === OkTypeTagName ||
|
|
27
|
-
maybeResult.$$tag === ErrTypeTagName);
|
|
28
|
-
//# sourceMappingURL=ternary-result-is-ternary-result.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-is-ternary-result.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,WAAoB,EACiB,EAAE,CACvC,QAAQ,CAAC,WAAW,CAAC;IACrB,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;IAC5B,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;IAC5B,CAAC,CAAC,WAAW,CAAC,KAAK,KAAK,eAAe,IAAI,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACxE,WAAW,CAAC,KAAK,KAAK,aAAa;QACnC,WAAW,CAAC,KAAK,KAAK,cAAc,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type UnknownTernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
import { type NarrowToWarn } from './types.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Type guard for the Warn variant.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const maybeWarn = TernaryResult.warn(
|
|
10
|
-
* 'value',
|
|
11
|
-
* 'check logs',
|
|
12
|
-
* ) as TernaryResult<string, string, string>;
|
|
13
|
-
*
|
|
14
|
-
* if (TernaryResult.isWarn(maybeWarn)) {
|
|
15
|
-
* assert.strictEqual(maybeWarn.value, 'value');
|
|
16
|
-
*
|
|
17
|
-
* assert.strictEqual(maybeWarn.warning, 'check logs');
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare const isWarn: <R extends UnknownTernaryResult>(result: R) => result is NarrowToWarn<R>;
|
|
22
|
-
//# sourceMappingURL=ternary-result-is-warn.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-is-warn.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-is-warn.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,oBAAoB,UAC3C,CAAC,KACR,MAAM,IAAI,YAAY,CAAC,CAAC,CAAqC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-is-warn.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-is-warn.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,MAAS,EACkB,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,eAAe,CAAC"}
|
|
@@ -1,27 +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
|
-
* Maps the Err variant while leaving Ok/Warn untouched.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const errValue = TernaryResult.err('boom');
|
|
10
|
-
*
|
|
11
|
-
* const mappedErr = TernaryResult.mapErr(errValue, (error) =>
|
|
12
|
-
* error.toUpperCase(),
|
|
13
|
-
* );
|
|
14
|
-
*
|
|
15
|
-
* const warnPassthrough = TernaryResult.mapErr(
|
|
16
|
-
* TernaryResult.warn(2, 'slow'),
|
|
17
|
-
* (error: string) => `${error}!`,
|
|
18
|
-
* );
|
|
19
|
-
*
|
|
20
|
-
* assert.deepStrictEqual(mappedErr, TernaryResult.err('BOOM'));
|
|
21
|
-
*
|
|
22
|
-
* assert.deepStrictEqual(warnPassthrough, TernaryResult.warn(2, 'slow'));
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function mapErr<R extends UnknownTernaryResult, E2>(result: R, mapFn: (error: UnwrapErr<R>) => E2): TernaryResult<UnwrapOk<R>, E2, UnwrapWarn<R>>;
|
|
26
|
-
export declare function mapErr<E, E2>(mapFn: (error: E) => E2): <S, W>(result: TernaryResult<S, E, W>) => TernaryResult<S, E2, W>;
|
|
27
|
-
//# sourceMappingURL=ternary-result-map-err.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-map-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-map-err.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,oBAAoB,EAAE,EAAE,EACvD,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,GACjC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAGjD,wBAAgB,MAAM,CAAC,CAAC,EAAE,EAAE,EAC1B,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GACtB,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { err } from './ternary-result-err.mjs';
|
|
2
|
-
import { isErr } from './ternary-result-is-err.mjs';
|
|
3
|
-
export function mapErr(...args) {
|
|
4
|
-
switch (args.length) {
|
|
5
|
-
case 2: {
|
|
6
|
-
const [result, mapFn] = args;
|
|
7
|
-
return mapErrImpl(result, mapFn);
|
|
8
|
-
}
|
|
9
|
-
case 1: {
|
|
10
|
-
const [mapFn] = args;
|
|
11
|
-
return (result) => mapErrImpl(result, mapFn);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const mapErrImpl = (result, mapFn) => {
|
|
16
|
-
if (isErr(result)) {
|
|
17
|
-
|
|
18
|
-
return err(mapFn(result.value));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return result;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=ternary-result-map-err.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-map-err.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-map-err.mts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAmCpD,MAAM,UAAU,MAAM,CACpB,GAAG,IAE8C;IAIjD,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;YAE7B,OAAO,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YAErB,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,CACjB,MAAS,EACT,KAAkC,EACa,EAAE;IACjD,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,oEAAoE;QACpE,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,oEAAoE;IACpE,OAAO,MAAuD,CAAC;AACjE,CAAC,CAAC"}
|
|
@@ -1,28 +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
|
-
* Maps the Warn variant while leaving Ok/Err untouched.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const warnValue = TernaryResult.warn(2, 'slow');
|
|
10
|
-
*
|
|
11
|
-
* const mappedWarn = TernaryResult.mapWarn(
|
|
12
|
-
* warnValue,
|
|
13
|
-
* (warning) => `${warning}!`,
|
|
14
|
-
* );
|
|
15
|
-
*
|
|
16
|
-
* const okPassthrough = TernaryResult.mapWarn(
|
|
17
|
-
* TernaryResult.ok(3),
|
|
18
|
-
* (value: number) => value * 2,
|
|
19
|
-
* );
|
|
20
|
-
*
|
|
21
|
-
* assert.deepStrictEqual(mappedWarn, TernaryResult.warn(2, 'slow!'));
|
|
22
|
-
*
|
|
23
|
-
* assert.deepStrictEqual(okPassthrough, TernaryResult.ok(3));
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export declare function mapWarn<R extends UnknownTernaryResult, W2>(result: R, mapFn: (warning: UnwrapWarn<R>) => W2): TernaryResult<UnwrapOk<R>, UnwrapErr<R>, W2>;
|
|
27
|
-
export declare function mapWarn<W, W2>(mapFn: (warning: W) => W2): <S, E>(result: TernaryResult<S, E, W>) => TernaryResult<S, E, W2>;
|
|
28
|
-
//# sourceMappingURL=ternary-result-map-warn.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-map-warn.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-map-warn.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,oBAAoB,EAAE,EAAE,EACxD,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,GACpC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAGhD,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,EAC3B,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,GACxB,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { isWarn } from './ternary-result-is-warn.mjs';
|
|
2
|
-
import { warn } from './ternary-result-warn.mjs';
|
|
3
|
-
export function mapWarn(...args) {
|
|
4
|
-
switch (args.length) {
|
|
5
|
-
case 2: {
|
|
6
|
-
const [result, mapFn] = args;
|
|
7
|
-
return mapWarnImpl(result, mapFn);
|
|
8
|
-
}
|
|
9
|
-
case 1: {
|
|
10
|
-
const [mapFn] = args;
|
|
11
|
-
return (result) => mapWarnImpl(result, mapFn);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const mapWarnImpl = (result, mapFn) => {
|
|
16
|
-
if (isWarn(result)) {
|
|
17
|
-
return warn(
|
|
18
|
-
|
|
19
|
-
result.value,
|
|
20
|
-
|
|
21
|
-
mapFn(result.warning));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=ternary-result-map-warn.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-map-warn.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-map-warn.mts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAoCjD,MAAM,UAAU,OAAO,CACrB,GAAG,IAEiD;IAIpD,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;YAE7B,OAAO,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YAErB,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAG,CAClB,MAAS,EACT,KAAqC,EACS,EAAE;IAChD,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI;QACT,oEAAoE;QACpE,MAAM,CAAC,KAAoB;QAC3B,oEAAoE;QACpE,KAAK,CAAC,MAAM,CAAC,OAAwB,CAAC,CACvC,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,OAAO,MAAsD,CAAC;AAChE,CAAC,CAAC"}
|
|
@@ -1,36 +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
|
-
* Maps the Ok variant while leaving Warn/Err untouched.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const okNumber = TernaryResult.ok(5);
|
|
10
|
-
*
|
|
11
|
-
* const warnValue = TernaryResult.warn(5, 'slow');
|
|
12
|
-
*
|
|
13
|
-
* const errValue = TernaryResult.err('bad');
|
|
14
|
-
*
|
|
15
|
-
* const doubled = TernaryResult.map(okNumber, (value) => value * 2);
|
|
16
|
-
*
|
|
17
|
-
* const warnPassthrough = TernaryResult.map(
|
|
18
|
-
* warnValue,
|
|
19
|
-
* (value: number) => value * 2,
|
|
20
|
-
* );
|
|
21
|
-
*
|
|
22
|
-
* const errPassthrough = TernaryResult.map(
|
|
23
|
-
* errValue,
|
|
24
|
-
* (value: number) => value * 2,
|
|
25
|
-
* );
|
|
26
|
-
*
|
|
27
|
-
* assert.deepStrictEqual(doubled, TernaryResult.ok(10));
|
|
28
|
-
*
|
|
29
|
-
* assert.deepStrictEqual(warnPassthrough, TernaryResult.warn(10, 'slow'));
|
|
30
|
-
*
|
|
31
|
-
* assert.deepStrictEqual(errPassthrough, errValue);
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function map<R extends UnknownTernaryResult, S2>(result: R, mapFn: (value: UnwrapOk<R>) => S2): TernaryResult<S2, UnwrapErr<R>, UnwrapWarn<R>>;
|
|
35
|
-
export declare function map<S, S2>(mapFn: (value: S) => S2): <W, E>(result: TernaryResult<S, E, W>) => TernaryResult<S2, E, W>;
|
|
36
|
-
//# sourceMappingURL=ternary-result-map.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-map.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-map.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,oBAAoB,EAAE,EAAE,EACpD,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,GAChC,aAAa,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAGlD,wBAAgB,GAAG,CAAC,CAAC,EAAE,EAAE,EACvB,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GACtB,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { isOk } from './ternary-result-is-ok.mjs';
|
|
2
|
-
import { isWarn } from './ternary-result-is-warn.mjs';
|
|
3
|
-
import { ok } from './ternary-result-ok.mjs';
|
|
4
|
-
import { warn } from './ternary-result-warn.mjs';
|
|
5
|
-
export function map(...args) {
|
|
6
|
-
switch (args.length) {
|
|
7
|
-
case 2: {
|
|
8
|
-
const [result, mapFn] = args;
|
|
9
|
-
return mapImpl(result, mapFn);
|
|
10
|
-
}
|
|
11
|
-
case 1: {
|
|
12
|
-
const [mapFn] = args;
|
|
13
|
-
return (result) => mapImpl(result, mapFn);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
const mapImpl = (result, mapFn) => {
|
|
18
|
-
if (isOk(result)) {
|
|
19
|
-
|
|
20
|
-
return ok(mapFn(result.value));
|
|
21
|
-
}
|
|
22
|
-
if (isWarn(result)) {
|
|
23
|
-
return warn(
|
|
24
|
-
|
|
25
|
-
mapFn(result.value),
|
|
26
|
-
|
|
27
|
-
result.warning);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=ternary-result-map.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-map.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-map.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AA4CjD,MAAM,UAAU,GAAG,CACjB,GAAG,IAE6C;IAIhD,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;YAE7B,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YAErB,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG,CACd,MAAS,EACT,KAAiC,EACe,EAAE;IAClD,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjB,oEAAoE;QACpE,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAoB,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI;QACT,oEAAoE;QACpE,KAAK,CAAC,MAAM,CAAC,KAAoB,CAAC;QAClC,oEAAoE;QACpE,MAAM,CAAC,OAAwB,CAChC,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,OAAO,MAAkC,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type TernaryOk } from '../ternary-result.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a `TernaryResult.Ok` containing the provided value.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* const success = TernaryResult.ok({ id: 1 });
|
|
9
|
-
*
|
|
10
|
-
* assert.deepStrictEqual(success, {
|
|
11
|
-
* $$tag: 'ts-data-forge::Result.ok',
|
|
12
|
-
* value: { id: 1 },
|
|
13
|
-
* });
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare const ok: <const S>(value: S) => TernaryOk<S>;
|
|
17
|
-
//# sourceMappingURL=ternary-result-ok.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-ok.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,EAAE,GAAI,KAAK,CAAC,CAAC,SAAU,CAAC,KAAG,SAAS,CAAC,CAAC,CAItC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-ok.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-ok.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,CAAW,KAAQ,EAAgB,EAAE,CACrD,CAAC;IACC,KAAK,EAAE,aAAa;IACpB,KAAK;CACN,CAAU,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type UnknownTernaryResult } from '../ternary-result.mjs';
|
|
2
|
-
import { type NarrowToOk, type NarrowToWarn } from './types.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Returns the original result if it is Ok, otherwise the provided fallback.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const fallback = TernaryResult.ok('fallback');
|
|
10
|
-
*
|
|
11
|
-
* assert.deepStrictEqual(
|
|
12
|
-
* TernaryResult.orElse(TernaryResult.ok('value'), fallback),
|
|
13
|
-
* TernaryResult.ok('value'),
|
|
14
|
-
* );
|
|
15
|
-
*
|
|
16
|
-
* assert.deepStrictEqual(
|
|
17
|
-
* TernaryResult.orElse(TernaryResult.warn('value', 'warn'), fallback),
|
|
18
|
-
* TernaryResult.warn('value', 'warn'),
|
|
19
|
-
* );
|
|
20
|
-
*
|
|
21
|
-
* assert.deepStrictEqual(
|
|
22
|
-
* TernaryResult.orElse(TernaryResult.err('err'), fallback),
|
|
23
|
-
* fallback,
|
|
24
|
-
* );
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function orElse<R extends UnknownTernaryResult, R2 extends UnknownTernaryResult>(result: R, alternative: R2): NarrowToOk<R> | NarrowToWarn<R> | R2;
|
|
28
|
-
export declare function orElse<R2 extends UnknownTernaryResult>(alternative: R2): <R extends UnknownTernaryResult>(result: R) => NarrowToOk<R> | NarrowToWarn<R> | R2;
|
|
29
|
-
//# sourceMappingURL=ternary-result-or-else.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-or-else.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-or-else.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CACpB,CAAC,SAAS,oBAAoB,EAC9B,EAAE,SAAS,oBAAoB,EAC/B,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAGpE,wBAAgB,MAAM,CAAC,EAAE,SAAS,oBAAoB,EACpD,WAAW,EAAE,EAAE,GACd,CAAC,CAAC,SAAS,oBAAoB,EAChC,MAAM,EAAE,CAAC,KACN,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC"}
|