ts-data-forge 14.6.1 → 14.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array/impl/array-utils-creation.mjs +126 -26
- package/dist/array/impl/array-utils-creation.mjs.map +1 -1
- package/dist/array/impl/array-utils-element-access.mjs +63 -30
- package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
- package/dist/array/impl/array-utils-iterators.mjs +68 -52
- package/dist/array/impl/array-utils-iterators.mjs.map +1 -1
- package/dist/array/impl/array-utils-length-bounded-array-cast.mjs +109 -73
- package/dist/array/impl/array-utils-length-bounded-array-cast.mjs.map +1 -1
- package/dist/array/impl/array-utils-length-bounded-array-guard.mjs +70 -32
- package/dist/array/impl/array-utils-length-bounded-array-guard.mjs.map +1 -1
- package/dist/array/impl/array-utils-length-bounded-tuple-cast.mjs +102 -73
- package/dist/array/impl/array-utils-length-bounded-tuple-cast.mjs.map +1 -1
- package/dist/array/impl/array-utils-length-bounded-tuple-guard.mjs +77 -33
- package/dist/array/impl/array-utils-length-bounded-tuple-guard.mjs.map +1 -1
- package/dist/array/impl/array-utils-modification.mjs +75 -122
- package/dist/array/impl/array-utils-modification.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs +99 -149
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.mjs +112 -136
- package/dist/array/impl/array-utils-search.mjs.map +1 -1
- package/dist/array/impl/array-utils-set-op.mjs +146 -38
- package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
- package/dist/array/impl/array-utils-size.mjs +10 -8
- package/dist/array/impl/array-utils-size.mjs.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.mjs +13 -50
- package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
- package/dist/array/impl/array-utils-slicing.mjs +92 -76
- package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +291 -199
- package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +53 -55
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/array/impl/index.mjs +17 -17
- package/dist/array/impl/index.mjs.map +1 -1
- package/dist/array/index.mjs +2 -3
- package/dist/array/index.mjs.map +1 -1
- package/dist/collections/imap-mapped.mjs +335 -292
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.mjs +280 -239
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/index.mjs +7 -7
- package/dist/collections/index.mjs.map +1 -1
- package/dist/collections/iset-mapped.mjs +448 -265
- package/dist/collections/iset-mapped.mjs.map +1 -1
- package/dist/collections/iset.mjs +328 -201
- package/dist/collections/iset.mjs.map +1 -1
- package/dist/collections/queue.mjs +181 -149
- package/dist/collections/queue.mjs.map +1 -1
- package/dist/collections/stack.mjs +167 -138
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/entry-point.mjs +4 -77
- package/dist/entry-point.mjs.map +1 -1
- package/dist/expect-type.mjs +69 -3
- package/dist/expect-type.mjs.map +1 -1
- package/dist/functional/async-result/async-result.mjs +2 -3
- package/dist/functional/async-result/async-result.mjs.map +1 -1
- package/dist/functional/async-result/impl/async-result-flat-map.mjs +18 -20
- package/dist/functional/async-result/impl/async-result-flat-map.mjs.map +1 -1
- package/dist/functional/async-result/impl/async-result-from-promise.mjs +9 -10
- package/dist/functional/async-result/impl/async-result-from-promise.mjs.map +1 -1
- package/dist/functional/async-result/impl/async-result-from-throwable.mjs +12 -14
- package/dist/functional/async-result/impl/async-result-from-throwable.mjs.map +1 -1
- package/dist/functional/async-result/impl/async-result-map-err.mjs +15 -18
- package/dist/functional/async-result/impl/async-result-map-err.mjs.map +1 -1
- package/dist/functional/async-result/impl/async-result-map.mjs +15 -18
- package/dist/functional/async-result/impl/async-result-map.mjs.map +1 -1
- package/dist/functional/async-result/impl/async-result-unwrap-or.mjs +35 -8
- package/dist/functional/async-result/impl/async-result-unwrap-or.mjs.map +1 -1
- package/dist/functional/async-result/impl/index.mjs +8 -7
- package/dist/functional/async-result/impl/index.mjs.map +1 -1
- package/dist/functional/async-result/impl/types.mjs +2 -2
- package/dist/functional/async-result/impl/types.mjs.map +1 -1
- package/dist/functional/async-result/index.mjs +2 -3
- package/dist/functional/async-result/index.mjs.map +1 -1
- package/dist/functional/index.mjs +7 -11
- package/dist/functional/index.mjs.map +1 -1
- package/dist/functional/match.mjs +27 -13
- package/dist/functional/match.mjs.map +1 -1
- package/dist/functional/optional/impl/index.mjs +19 -18
- package/dist/functional/optional/impl/index.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-expect-to-be.mjs +15 -17
- package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-filter.mjs +16 -18
- package/dist/functional/optional/impl/optional-filter.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-flat-map.mjs +12 -14
- package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-from-nullable.mjs +24 -3
- package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-none.mjs +19 -3
- package/dist/functional/optional/impl/optional-is-none.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-optional.mjs +24 -6
- package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.mjs +20 -3
- package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-map.mjs +15 -17
- package/dist/functional/optional/impl/optional-map.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-match.mjs +15 -17
- package/dist/functional/optional/impl/optional-match.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-none.mjs +16 -3
- package/dist/functional/optional/impl/optional-none.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-or-else.mjs +12 -14
- package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-some.mjs +22 -6
- package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.mjs +26 -3
- package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.mjs +11 -13
- package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs +33 -8
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap.mjs +6 -9
- package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-zip.mjs +34 -3
- package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
- package/dist/functional/optional/impl/tag.mjs +3 -4
- package/dist/functional/optional/impl/tag.mjs.map +1 -1
- package/dist/functional/optional/impl/types.mjs +2 -2
- package/dist/functional/optional/impl/types.mjs.map +1 -1
- package/dist/functional/optional/index.mjs +2 -3
- package/dist/functional/optional/index.mjs.map +1 -1
- package/dist/functional/optional/optional.mjs +2 -3
- package/dist/functional/optional/optional.mjs.map +1 -1
- package/dist/functional/pipe.mjs +42 -14
- package/dist/functional/pipe.mjs.map +1 -1
- package/dist/functional/result/impl/index.mjs +28 -27
- package/dist/functional/result/impl/index.mjs.map +1 -1
- package/dist/functional/result/impl/result-err.mjs +28 -6
- package/dist/functional/result/impl/result-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.mjs +16 -17
- package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
- package/dist/functional/result/impl/result-flat-map.mjs +17 -20
- package/dist/functional/result/impl/result-flat-map.mjs.map +1 -1
- package/dist/functional/result/impl/result-fold.mjs +17 -20
- package/dist/functional/result/impl/result-fold.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-optional.mjs +16 -19
- package/dist/functional/result/impl/result-from-optional.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-promise.mjs +35 -6
- package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.mjs +40 -13
- package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-err.mjs +19 -3
- package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-ok.mjs +19 -3
- package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-result.mjs +23 -5
- package/dist/functional/result/impl/result-is-result.mjs.map +1 -1
- package/dist/functional/result/impl/result-map-err.mjs +17 -20
- package/dist/functional/result/impl/result-map-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-map.mjs +17 -20
- package/dist/functional/result/impl/result-map.mjs.map +1 -1
- package/dist/functional/result/impl/result-match.mjs +16 -20
- package/dist/functional/result/impl/result-match.mjs.map +1 -1
- package/dist/functional/result/impl/result-ok.mjs +28 -6
- package/dist/functional/result/impl/result-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-or-else.mjs +13 -14
- package/dist/functional/result/impl/result-or-else.mjs.map +1 -1
- package/dist/functional/result/impl/result-safe-try.mjs +32 -21
- package/dist/functional/result/impl/result-safe-try.mjs.map +1 -1
- package/dist/functional/result/impl/result-safe-unwrap.mjs +39 -11
- package/dist/functional/result/impl/result-safe-unwrap.mjs.map +1 -1
- package/dist/functional/result/impl/result-swap.mjs +21 -6
- package/dist/functional/result/impl/result-swap.mjs.map +1 -1
- package/dist/functional/result/impl/result-to-optional.mjs +28 -5
- package/dist/functional/result/impl/result-to-optional.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-or.mjs +12 -13
- package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs +42 -19
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.mjs +31 -6
- package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs +12 -13
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok.mjs +6 -9
- package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs +37 -10
- package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-zip.mjs +33 -3
- package/dist/functional/result/impl/result-zip.mjs.map +1 -1
- package/dist/functional/result/impl/tag.mjs +3 -4
- package/dist/functional/result/impl/tag.mjs.map +1 -1
- package/dist/functional/result/impl/types.mjs +2 -2
- package/dist/functional/result/impl/types.mjs.map +1 -1
- package/dist/functional/result/index.mjs +2 -3
- package/dist/functional/result/index.mjs.map +1 -1
- package/dist/functional/result/result.mjs +2 -3
- package/dist/functional/result/result.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/index.mjs +29 -28
- package/dist/functional/ternary-result/impl/index.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/tag.mjs +5 -5
- package/dist/functional/ternary-result/impl/tag.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs +16 -6
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs +15 -18
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs +29 -33
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-fold.mjs +24 -26
- package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +19 -6
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +27 -12
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs +17 -3
- package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +19 -3
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +26 -6
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +18 -3
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs +17 -18
- package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs +20 -23
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map.mjs +24 -26
- package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs +17 -6
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs +11 -14
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +22 -8
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs +11 -14
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +29 -18
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +18 -6
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs +11 -14
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs +6 -8
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +31 -23
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs +11 -14
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +26 -16
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +18 -6
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs +20 -7
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +46 -18
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/types.mjs +2 -2
- package/dist/functional/ternary-result/impl/types.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/variant-name.mjs +11 -13
- package/dist/functional/ternary-result/impl/variant-name.mjs.map +1 -1
- package/dist/functional/ternary-result/index.mjs +2 -3
- package/dist/functional/ternary-result/index.mjs.map +1 -1
- package/dist/functional/ternary-result/ternary-result.mjs +2 -3
- package/dist/functional/ternary-result/ternary-result.mjs.map +1 -1
- package/dist/guard/has-key.mjs +42 -3
- package/dist/guard/has-key.mjs.map +1 -1
- package/dist/guard/index.mjs +8 -8
- package/dist/guard/index.mjs.map +1 -1
- package/dist/guard/is-non-empty-string.mjs +38 -3
- package/dist/guard/is-non-empty-string.mjs.map +1 -1
- package/dist/guard/is-non-null-object.mjs +35 -3
- package/dist/guard/is-non-null-object.mjs.map +1 -1
- package/dist/guard/is-primitive.mjs +46 -15
- package/dist/guard/is-primitive.mjs.map +1 -1
- package/dist/guard/is-record.mjs +87 -4
- package/dist/guard/is-record.mjs.map +1 -1
- package/dist/guard/is-type.mjs +404 -19
- package/dist/guard/is-type.mjs.map +1 -1
- package/dist/guard/key-is-in.mjs +41 -3
- package/dist/guard/key-is-in.mjs.map +1 -1
- package/dist/index.mjs +12 -65
- package/dist/index.mjs.map +1 -1
- package/dist/iterator/index.mjs +2 -2
- package/dist/iterator/index.mjs.map +1 -1
- package/dist/iterator/range.mjs +18 -56
- package/dist/iterator/range.mjs.map +1 -1
- package/dist/json/index.mjs +2 -2
- package/dist/json/index.mjs.map +1 -1
- package/dist/json/json.mjs +346 -105
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/finite-number.mjs +148 -137
- package/dist/number/branded-types/finite-number.mjs.map +1 -1
- package/dist/number/branded-types/index.mjs +33 -33
- package/dist/number/branded-types/index.mjs.map +1 -1
- package/dist/number/branded-types/int.mjs +245 -209
- package/dist/number/branded-types/int.mjs.map +1 -1
- package/dist/number/branded-types/int16.mjs +141 -131
- package/dist/number/branded-types/int16.mjs.map +1 -1
- package/dist/number/branded-types/int32.mjs +141 -131
- package/dist/number/branded-types/int32.mjs.map +1 -1
- package/dist/number/branded-types/negative-finite-number.mjs +155 -149
- package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/negative-int.mjs +125 -110
- package/dist/number/branded-types/negative-int.mjs.map +1 -1
- package/dist/number/branded-types/negative-safe-int.mjs +126 -115
- package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-finite-number.mjs +164 -154
- package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int16.mjs +137 -125
- package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int32.mjs +137 -125
- package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-finite-number.mjs +143 -139
- package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-int.mjs +116 -99
- package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-safe-int.mjs +118 -107
- package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-finite-number.mjs +144 -129
- package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int.mjs +102 -82
- package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int16.mjs +118 -105
- package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int32.mjs +118 -105
- package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +121 -107
- package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.mjs +118 -104
- package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.mjs +118 -104
- package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
- package/dist/number/branded-types/positive-finite-number.mjs +167 -160
- package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/positive-int.mjs +260 -224
- package/dist/number/branded-types/positive-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-int16.mjs +134 -122
- package/dist/number/branded-types/positive-int16.mjs.map +1 -1
- package/dist/number/branded-types/positive-int32.mjs +134 -122
- package/dist/number/branded-types/positive-int32.mjs.map +1 -1
- package/dist/number/branded-types/positive-safe-int.mjs +291 -257
- package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint16.mjs +134 -122
- package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint32.mjs +134 -122
- package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
- package/dist/number/branded-types/safe-int.mjs +283 -254
- package/dist/number/branded-types/safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-uint.mjs +134 -123
- package/dist/number/branded-types/safe-uint.mjs.map +1 -1
- package/dist/number/branded-types/uint.mjs +248 -211
- package/dist/number/branded-types/uint.mjs.map +1 -1
- package/dist/number/branded-types/uint16.mjs +132 -121
- package/dist/number/branded-types/uint16.mjs.map +1 -1
- package/dist/number/branded-types/uint32.mjs +132 -121
- package/dist/number/branded-types/uint32.mjs.map +1 -1
- package/dist/number/enum/index.mjs +3 -3
- package/dist/number/enum/index.mjs.map +1 -1
- package/dist/number/enum/int8.mjs +146 -131
- package/dist/number/enum/int8.mjs.map +1 -1
- package/dist/number/enum/uint8.mjs +133 -119
- package/dist/number/enum/uint8.mjs.map +1 -1
- package/dist/number/index.mjs +6 -37
- package/dist/number/index.mjs.map +1 -1
- package/dist/number/num-arithmetic-types.mjs +42 -1
- package/dist/number/num-arithmetic-types.mjs.map +1 -1
- package/dist/number/num.mjs +549 -91
- package/dist/number/num.mjs.map +1 -1
- package/dist/number/refined-number-utils.mjs +294 -133
- package/dist/number/refined-number-utils.mjs.map +1 -1
- package/dist/object/index.mjs +2 -2
- package/dist/object/index.mjs.map +1 -1
- package/dist/object/object.mjs +356 -203
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/cast-mutable.mjs +38 -11
- package/dist/others/cast-mutable.mjs.map +1 -1
- package/dist/others/cast-readonly.mjs +37 -11
- package/dist/others/cast-readonly.mjs.map +1 -1
- package/dist/others/debounce-function.mjs +22 -11
- package/dist/others/debounce-function.mjs.map +1 -1
- package/dist/others/fast-deep-equal.mjs +70 -51
- package/dist/others/fast-deep-equal.mjs.map +1 -1
- package/dist/others/if-then.mjs +31 -4
- package/dist/others/if-then.mjs.map +1 -1
- package/dist/others/index.mjs +10 -10
- package/dist/others/index.mjs.map +1 -1
- package/dist/others/map-nullable.mjs +11 -13
- package/dist/others/map-nullable.mjs.map +1 -1
- package/dist/others/memoize-function.mjs +14 -16
- package/dist/others/memoize-function.mjs.map +1 -1
- package/dist/others/tuple.mjs +51 -3
- package/dist/others/tuple.mjs.map +1 -1
- package/dist/others/unknown-to-string.mjs +91 -47
- package/dist/others/unknown-to-string.mjs.map +1 -1
- package/dist/promise/index.mjs +2 -2
- package/dist/promise/index.mjs.map +1 -1
- package/dist/promise/promise.mjs +49 -8
- package/dist/promise/promise.mjs.map +1 -1
- package/dist/string/index.mjs +2 -2
- package/dist/string/index.mjs.map +1 -1
- package/dist/string/str.mjs +250 -83
- package/dist/string/str.mjs.map +1 -1
- package/dist/types.mjs +2 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +6 -7
- package/src/guard/is-type.test.mts +2 -2
- package/src/number/branded-types/finite-number.test.mts +1 -1
- package/src/number/branded-types/int.test.mts +1 -1
- package/src/number/branded-types/int16.test.mts +1 -1
- package/src/number/branded-types/int32.test.mts +1 -1
- package/src/number/branded-types/non-negative-finite-number.test.mts +1 -1
- package/src/number/branded-types/non-negative-int16.test.mts +1 -1
- package/src/number/branded-types/non-negative-int32.test.mts +1 -1
- package/src/number/branded-types/non-zero-finite-number.test.mts +1 -1
- package/src/number/branded-types/non-zero-int.test.mts +1 -1
- package/src/number/branded-types/non-zero-int16.test.mts +1 -1
- package/src/number/branded-types/non-zero-int32.test.mts +1 -1
- package/src/number/branded-types/non-zero-safe-int.test.mts +1 -1
- package/src/number/branded-types/non-zero-uint16.test.mts +1 -1
- package/src/number/branded-types/non-zero-uint32.test.mts +1 -1
- package/src/number/branded-types/positive-finite-number.test.mts +1 -1
- package/src/number/branded-types/positive-int.test.mts +1 -1
- package/src/number/branded-types/positive-int16.test.mts +1 -1
- package/src/number/branded-types/positive-int32.test.mts +1 -1
- package/src/number/branded-types/positive-safe-int.test.mts +1 -1
- package/src/number/branded-types/positive-uint16.test.mts +1 -1
- package/src/number/branded-types/positive-uint32.test.mts +1 -1
- package/src/number/branded-types/safe-int.test.mts +1 -1
- package/src/number/branded-types/safe-uint.test.mts +1 -1
- package/src/number/branded-types/uint.test.mts +1 -1
- package/src/number/branded-types/uint16.test.mts +1 -1
- package/src/number/branded-types/uint32.test.mts +1 -1
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import { hasKey } from '../../../guard/
|
|
2
|
-
import { isRecord } from '../../../guard/is-record.mjs';
|
|
1
|
+
import { hasKey, isRecord } from '../../../guard/index.mjs';
|
|
3
2
|
import { ErrTypeTagName, OkTypeTagName } from './tag.mjs';
|
|
4
3
|
|
|
5
|
-
const isResult = (maybeResult) => isRecord(maybeResult) && hasKey(maybeResult, "$$tag") && hasKey(maybeResult, "value") && (maybeResult.$$tag === ErrTypeTagName || maybeResult.$$tag === OkTypeTagName);
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export const isResult = (maybeResult) => isRecord(maybeResult) &&
|
|
23
|
+
hasKey(maybeResult, '$$tag') &&
|
|
24
|
+
hasKey(maybeResult, 'value') &&
|
|
25
|
+
(maybeResult.$$tag === ErrTypeTagName || maybeResult.$$tag === OkTypeTagName);
|
|
26
|
+
//# sourceMappingURL=result-is-result.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-is-result.mjs","sources":["../../../../src/functional/result/impl/result-is-result.mts"],"
|
|
1
|
+
{"version":3,"file":"result-is-result.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-is-result.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,WAAoB,EAAgC,EAAE,CAC7E,QAAQ,CAAC,WAAW,CAAC;IACrB,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;IAC5B,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;IAC5B,CAAC,WAAW,CAAC,KAAK,KAAK,cAAc,IAAI,WAAW,CAAC,KAAK,KAAK,aAAa,CAAC,CAAC"}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { err } from './result-err.mjs';
|
|
2
2
|
import { isOk } from './result-is-ok.mjs';
|
|
3
|
+
export function mapErr(...args) {
|
|
4
|
+
switch (args.length) {
|
|
5
|
+
case 2: {
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (result) => mapErrImpl(result, mapFn);
|
|
7
|
+
const [result, mapFn] = args;
|
|
8
|
+
return mapErrImpl(result, mapFn);
|
|
9
|
+
}
|
|
10
|
+
case 1: {
|
|
11
|
+
|
|
12
|
+
const [mapFn] = args;
|
|
13
|
+
return (result) => mapErrImpl(result, mapFn);
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
|
-
}
|
|
15
16
|
}
|
|
16
|
-
const mapErrImpl = (result, mapFn) => isOk(result)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export { mapErr };
|
|
25
|
-
//# sourceMappingURL=result-map-err.mjs.map
|
|
17
|
+
const mapErrImpl = (result, mapFn) => isOk(result)
|
|
18
|
+
?
|
|
19
|
+
result
|
|
20
|
+
:
|
|
21
|
+
err(mapFn(result.value));
|
|
22
|
+
//# sourceMappingURL=result-map-err.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-map-err.mjs","sources":["../../../../src/functional/result/impl/result-map-err.mts"],"
|
|
1
|
+
{"version":3,"file":"result-map-err.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-map-err.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AA8D1C,MAAM,UAAU,MAAM,CACpB,GAAG,IAE8C;IAEjD,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,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,sDAAsD;YACtD,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,EACT,EAAE,CAC3B,IAAI,CAAC,MAAM,CAAC;IACV,CAAC,CAAC,oEAAoE;QACnE,MAA0B;IAC7B,CAAC,CAAC,oEAAoE;QACpE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC,CAAC"}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { isErr } from './result-is-err.mjs';
|
|
2
2
|
import { ok } from './result-ok.mjs';
|
|
3
|
+
export function map(...args) {
|
|
4
|
+
switch (args.length) {
|
|
5
|
+
case 2: {
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (result) => mapImpl(result, mapFn);
|
|
7
|
+
const [result, mapFn] = args;
|
|
8
|
+
return mapImpl(result, mapFn);
|
|
9
|
+
}
|
|
10
|
+
case 1: {
|
|
11
|
+
|
|
12
|
+
const [mapFn] = args;
|
|
13
|
+
return (result) => mapImpl(result, mapFn);
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
|
-
}
|
|
15
16
|
}
|
|
16
|
-
const mapImpl = (result, mapFn) => isErr(result)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export { map };
|
|
25
|
-
//# sourceMappingURL=result-map.mjs.map
|
|
17
|
+
const mapImpl = (result, mapFn) => isErr(result)
|
|
18
|
+
?
|
|
19
|
+
result
|
|
20
|
+
:
|
|
21
|
+
ok(mapFn(result.value));
|
|
22
|
+
//# sourceMappingURL=result-map.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-map.mjs","sources":["../../../../src/functional/result/impl/result-map.mts"],"
|
|
1
|
+
{"version":3,"file":"result-map.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-map.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AA8DrC,MAAM,UAAU,GAAG,CACjB,GAAG,IAE6C;IAEhD,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,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,kBAAkB;YAClB,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,EACP,EAAE,CAC5B,KAAK,CAAC,MAAM,CAAC;IACX,CAAC,CAAC,oEAAoE;QACnE,MAA4B;IAC/B,CAAC,CAAC,oEAAoE;QACpE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAoB,CAAC,CAAC,CAAC"}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { isOk } from './result-is-ok.mjs';
|
|
2
|
+
export function match(...args) {
|
|
3
|
+
switch (args.length) {
|
|
4
|
+
case 2: {
|
|
5
|
+
const [result, cases] = args;
|
|
6
|
+
return matchImpl(result, cases);
|
|
7
|
+
}
|
|
8
|
+
case 1: {
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const [result, cases] = args;
|
|
7
|
-
return matchImpl(result, cases);
|
|
10
|
+
const [cases] = args;
|
|
11
|
+
return (result) => matchImpl(result, cases);
|
|
12
|
+
}
|
|
8
13
|
}
|
|
9
|
-
case 1: {
|
|
10
|
-
const [cases] = args;
|
|
11
|
-
return (result) => matchImpl(result, cases);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
14
|
}
|
|
15
|
-
const matchImpl = (result, cases) => isOk(result)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
export { match };
|
|
24
|
-
//# sourceMappingURL=result-match.mjs.map
|
|
15
|
+
const matchImpl = (result, cases) => isOk(result)
|
|
16
|
+
?
|
|
17
|
+
cases.ok(result.value)
|
|
18
|
+
:
|
|
19
|
+
cases.err(result.value);
|
|
20
|
+
//# sourceMappingURL=result-match.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-match.mjs","sources":["../../../../src/functional/result/impl/result-match.mts"],"
|
|
1
|
+
{"version":3,"file":"result-match.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-match.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AA+D1C,MAAM,UAAU,KAAK,CACnB,GAAG,IAaE;IAEL,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;YAE7B,OAAO,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,0DAA0D;YAC1D,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YAErB,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,SAAS,GAAG,CAChB,MAAS,EACT,KAGE,EACO,EAAE,CACX,IAAI,CAAC,MAAM,CAAC;IACV,CAAC,CAAC,oEAAoE;QACpE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAoB,CAAC;IACvC,CAAC,CAAC,oEAAoE;QACpE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC"}
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { OkTypeTagName } from './tag.mjs';
|
|
2
2
|
|
|
3
|
-
const ok = (value) => ({
|
|
4
|
-
$$tag: OkTypeTagName,
|
|
5
|
-
value
|
|
6
|
-
});
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export const ok = (value) => ({
|
|
28
|
+
$$tag: OkTypeTagName,
|
|
29
|
+
value,
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=result-ok.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-ok.mjs","sources":["../../../../src/functional/result/impl/result-ok.mts"],"
|
|
1
|
+
{"version":3,"file":"result-ok.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-ok.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,CAAW,KAAQ,EAAS,EAAE,CAC9C,CAAC;IACC,KAAK,EAAE,aAAa;IACpB,KAAK;CACN,CAAU,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { isOk } from './result-is-ok.mjs';
|
|
2
|
+
export function orElse(...args) {
|
|
3
|
+
switch (args.length) {
|
|
4
|
+
case 2: {
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return (result) => orElseImpl(result, alternative);
|
|
6
|
+
const [result, alternative] = args;
|
|
7
|
+
return orElseImpl(result, alternative);
|
|
8
|
+
}
|
|
9
|
+
case 1: {
|
|
10
|
+
|
|
11
|
+
const [alternative] = args;
|
|
12
|
+
return (result) => orElseImpl(result, alternative);
|
|
13
|
+
}
|
|
12
14
|
}
|
|
13
|
-
}
|
|
14
15
|
}
|
|
15
|
-
const orElseImpl = (result, alternative) => isOk(result) ? result : alternative;
|
|
16
|
-
|
|
17
|
-
export { orElse };
|
|
18
|
-
//# sourceMappingURL=result-or-else.mjs.map
|
|
16
|
+
const orElseImpl = (result, alternative) => (isOk(result) ? result : alternative);
|
|
17
|
+
//# sourceMappingURL=result-or-else.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-or-else.mjs","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"
|
|
1
|
+
{"version":3,"file":"result-or-else.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-or-else.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAgD1C,MAAM,UAAU,MAAM,CACpB,GAAG,IAAwE;IAE3E,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC;YAEnC,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACzC,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,kBAAkB;YAClB,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;YAE3B,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,CACjB,MAAS,EACT,WAAe,EACK,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
-
import { hasKey } from '../../../guard/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { hasKey, isRecord } from '../../../guard/index.mjs';
|
|
2
|
+
export function safeTry(body) {
|
|
3
|
+
const generator = body();
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const step = generator.next();
|
|
8
|
+
if (isSyncStep(step)) {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
if (step.done !== true && isSyncGenerator(generator, step)) {
|
|
14
|
+
generator.return(step.value);
|
|
15
|
+
}
|
|
16
|
+
return step.value;
|
|
16
17
|
}
|
|
17
|
-
return asyncStep
|
|
18
|
-
|
|
18
|
+
return step.then(async (asyncStep) => {
|
|
19
|
+
if (asyncStep.done !== true) {
|
|
20
|
+
await generator.return(asyncStep.value);
|
|
21
|
+
}
|
|
22
|
+
return asyncStep.value;
|
|
23
|
+
});
|
|
19
24
|
}
|
|
20
|
-
const isSyncStep = (value) => isRecord(value) && hasKey(value, "done");
|
|
21
|
-
const isSyncGenerator = (_generator, step) => isSyncStep(step);
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const isSyncStep = (value) => isRecord(value) && hasKey(value, 'done');
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const isSyncGenerator = (_generator, step) => isSyncStep(step);
|
|
35
|
+
//# sourceMappingURL=result-safe-try.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-safe-try.mjs","sources":["../../../../src/functional/result/impl/result-safe-try.mts"],"
|
|
1
|
+
{"version":3,"file":"result-safe-try.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-safe-try.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AA0D5D,MAAM,UAAU,OAAO,CACrB,IAEmD;IAEnD,MAAM,SAAS,GAAG,IAAI,EAAE,CAAC;IAEzB,qEAAqE;IACrE,wEAAwE;IACxE,0DAA0D;IAC1D,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAE9B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,qEAAqE;QACrE,oEAAoE;QACpE,wEAAwE;QACxE,yEAAyE;QACzE,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;YAC3D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACnC,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC5B,MAAM,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,SAAS,CAAC,KAAK,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,4EAA4E;AAC5E,wEAAwE;AACxE,8EAA8E;AAC9E,OAAO;AACP,MAAM,UAAU,GAAG,CACjB,KAAc,EACyC,EAAE,CACzD,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAE3C,8EAA8E;AAC9E,wEAAwE;AACxE,6EAA6E;AAC7E,qBAAqB;AACrB,MAAM,eAAe,GAAG,CACtB,UAE2C,EAC3C,IAAa,EAC0C,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
import { isErr } from './result-is-err.mjs';
|
|
2
2
|
|
|
3
|
-
function* safeUnwrap(result) {
|
|
4
|
-
if (isErr(result)) {
|
|
5
|
-
yield result;
|
|
6
|
-
throw new Error(
|
|
7
|
-
"`safeUnwrap()` generator was resumed after yielding an `Err`; it must only be used via `yield*` inside `safeTry()`"
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
return result.value;
|
|
11
|
-
}
|
|
12
3
|
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
|
|
33
|
+
|
|
34
|
+
export function* safeUnwrap(result) {
|
|
35
|
+
if (isErr(result)) {
|
|
36
|
+
yield result;
|
|
37
|
+
throw new Error('`safeUnwrap()` generator was resumed after yielding an `Err`; it must only be used via `yield*` inside `safeTry()`');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return result.value;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=result-safe-unwrap.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-safe-unwrap.mjs","sources":["../../../../src/functional/result/impl/result-safe-unwrap.mts"],"
|
|
1
|
+
{"version":3,"file":"result-safe-unwrap.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-safe-unwrap.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,SAAS,CAAC,CAAC,UAAU,CACzB,MAAS;IAET,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC;QAEb,MAAM,IAAI,KAAK,CACb,oHAAoH,CACrH,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,OAAO,MAAM,CAAC,KAAoB,CAAC;AACrC,CAAC"}
|
|
@@ -3,10 +3,25 @@ import { isOk } from './result-is-ok.mjs';
|
|
|
3
3
|
import { ok } from './result-ok.mjs';
|
|
4
4
|
import { unwrapOk } from './result-unwrap-ok.mjs';
|
|
5
5
|
|
|
6
|
-
const swap = (result) => (
|
|
7
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
8
|
-
isOk(result) ? err(unwrapOk(result)) : ok(result.value)
|
|
9
|
-
);
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export const swap = (result) =>
|
|
25
|
+
|
|
26
|
+
isOk(result) ? err(unwrapOk(result)) : ok(result.value);
|
|
27
|
+
//# sourceMappingURL=result-swap.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-swap.mjs","sources":["../../../../src/functional/result/impl/result-swap.mts"],"
|
|
1
|
+
{"version":3,"file":"result-swap.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-swap.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAS,EAC0B,EAAE;AACrC,oEAAoE;AACpE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC"}
|
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { some } from '../../optional/impl/optional-some.mjs';
|
|
1
|
+
import { Optional } from '../../optional/index.mjs';
|
|
3
2
|
import { isOk } from './result-is-ok.mjs';
|
|
4
3
|
import { unwrapOk } from './result-unwrap-ok.mjs';
|
|
5
4
|
|
|
6
|
-
const toOptional = (result) => isOk(result) ? some(unwrapOk(result)) : none;
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
export const toOptional = (result) => isOk(result) ? Optional.some(unwrapOk(result)) : Optional.none;
|
|
32
|
+
//# sourceMappingURL=result-to-optional.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-to-optional.mjs","sources":["../../../../src/functional/result/impl/result-to-optional.mts"],"
|
|
1
|
+
{"version":3,"file":"result-to-optional.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-to-optional.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,MAAS,EACc,EAAE,CACzB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { unwrapErr } from './result-unwrap-err.mjs';
|
|
2
|
+
export function unwrapErrOr(...args) {
|
|
3
|
+
switch (args.length) {
|
|
4
|
+
case 2: {
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return (result) => unwrapErrOrImpl(result, defaultValue);
|
|
6
|
+
const [result, defaultValue] = args;
|
|
7
|
+
return unwrapErrOrImpl(result, defaultValue);
|
|
8
|
+
}
|
|
9
|
+
case 1: {
|
|
10
|
+
|
|
11
|
+
const [defaultValue] = args;
|
|
12
|
+
return (result) => unwrapErrOrImpl(result, defaultValue);
|
|
13
|
+
}
|
|
12
14
|
}
|
|
13
|
-
}
|
|
14
15
|
}
|
|
15
16
|
const unwrapErrOrImpl = (result, defaultValue) => unwrapErr(result) ?? defaultValue;
|
|
16
|
-
|
|
17
|
-
export { unwrapErrOr };
|
|
18
|
-
//# sourceMappingURL=result-unwrap-err-or.mjs.map
|
|
17
|
+
//# sourceMappingURL=result-unwrap-err-or.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-err-or.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"
|
|
1
|
+
{"version":3,"file":"result-unwrap-err-or.mjs","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-unwrap-err-or.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAyCpD,MAAM,UAAU,WAAW,CACzB,GAAG,IAAwE;IAE3E,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,2CAA2C;YAC3C,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI,CAAC;YAEpC,OAAO,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC/C,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,kBAAkB;YAClB,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;YAE5B,OAAO,CAAC,MAAS,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,eAAe,GAAG,CACtB,MAAS,EACT,YAAe,EACG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC"}
|