ts-data-forge 5.0.1 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -50
- package/dist/array/impl/array-utils-creation.d.mts +14 -0
- package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-creation.mjs +12 -0
- package/dist/array/impl/array-utils-creation.mjs.map +1 -1
- package/dist/array/impl/array-utils-element-access.d.mts +10 -0
- package/dist/array/impl/array-utils-element-access.d.mts.map +1 -1
- package/dist/array/impl/array-utils-element-access.mjs +6 -0
- package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
- package/dist/array/impl/array-utils-modification.d.mts +14 -0
- package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
- package/dist/array/impl/array-utils-modification.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.d.mts +34 -10
- package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.d.mts +34 -4
- package/dist/array/impl/array-utils-search.d.mts.map +1 -1
- package/dist/array/impl/array-utils-search.mjs.map +1 -1
- package/dist/array/impl/array-utils-set-op.d.mts +20 -7
- package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
- package/dist/array/impl/array-utils-set-op.mjs +20 -7
- package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
- package/dist/array/impl/array-utils-size.d.mts +5 -2
- package/dist/array/impl/array-utils-size.d.mts.map +1 -1
- package/dist/array/impl/array-utils-size.mjs +5 -2
- package/dist/array/impl/array-utils-size.mjs.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.d.mts +2 -0
- package/dist/array/impl/array-utils-slice-clamped.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
- package/dist/array/impl/array-utils-slicing.d.mts +17 -2
- package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slicing.mjs +9 -2
- package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.d.mts +27 -0
- package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +6 -0
- package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
- package/dist/array/impl/array-utils-validation.d.mts +35 -18
- package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +25 -14
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.d.mts +35 -15
- package/dist/collections/imap.d.mts.map +1 -1
- package/dist/collections/imap.mjs +5 -3
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/iset-mapped.d.mts +46 -19
- package/dist/collections/iset-mapped.d.mts.map +1 -1
- package/dist/collections/iset-mapped.mjs +9 -2
- package/dist/collections/iset-mapped.mjs.map +1 -1
- package/dist/collections/iset.d.mts +48 -19
- package/dist/collections/iset.d.mts.map +1 -1
- package/dist/collections/iset.mjs +9 -2
- package/dist/collections/iset.mjs.map +1 -1
- package/dist/collections/queue.d.mts +65 -25
- package/dist/collections/queue.d.mts.map +1 -1
- package/dist/collections/queue.mjs +13 -5
- package/dist/collections/queue.mjs.map +1 -1
- package/dist/collections/stack.d.mts +60 -25
- package/dist/collections/stack.d.mts.map +1 -1
- package/dist/collections/stack.mjs +12 -5
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/entry-point.mjs +1 -1
- package/dist/functional/match.d.mts +1 -1
- package/dist/functional/match.d.mts.map +1 -1
- package/dist/functional/match.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts +3 -2
- package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-filter.d.mts +3 -0
- package/dist/functional/optional/impl/optional-filter.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-filter.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-flat-map.d.mts +2 -0
- package/dist/functional/optional/impl/optional-flat-map.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-from-nullable.d.mts +2 -0
- package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-from-nullable.mjs +2 -0
- package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-none.d.mts +1 -1
- package/dist/functional/optional/impl/optional-is-none.mjs +1 -1
- package/dist/functional/optional/impl/optional-is-optional.d.mts +4 -2
- package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-optional.mjs +4 -2
- package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.d.mts +2 -1
- package/dist/functional/optional/impl/optional-is-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.mjs +2 -1
- package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-map.d.mts +2 -0
- package/dist/functional/optional/impl/optional-map.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-map.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-none.d.mts +4 -2
- package/dist/functional/optional/impl/optional-none.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-none.mjs +4 -2
- package/dist/functional/optional/impl/optional-none.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-or-else.d.mts +4 -0
- package/dist/functional/optional/impl/optional-or-else.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-some.d.mts +5 -3
- package/dist/functional/optional/impl/optional-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-some.mjs +4 -2
- package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.d.mts +4 -2
- package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.mjs +4 -2
- package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts +7 -4
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +2 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs +2 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap.d.mts +4 -2
- package/dist/functional/optional/impl/optional-unwrap.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-zip.d.mts +3 -1
- package/dist/functional/optional/impl/optional-zip.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-zip.mjs +3 -1
- package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
- package/dist/functional/pipe.d.mts +2 -2
- package/dist/functional/result/impl/result-err.d.mts +4 -2
- package/dist/functional/result/impl/result-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-err.mjs +3 -1
- package/dist/functional/result/impl/result-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.d.mts +3 -2
- package/dist/functional/result/impl/result-expect-to-be.d.mts.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
- package/dist/functional/result/impl/result-flat-map.d.mts +5 -0
- package/dist/functional/result/impl/result-flat-map.d.mts.map +1 -1
- package/dist/functional/result/impl/result-flat-map.mjs.map +1 -1
- package/dist/functional/result/impl/result-fold.d.mts +4 -0
- package/dist/functional/result/impl/result-fold.d.mts.map +1 -1
- package/dist/functional/result/impl/result-fold.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-promise.d.mts +4 -1
- package/dist/functional/result/impl/result-from-promise.d.mts.map +1 -1
- package/dist/functional/result/impl/result-from-promise.mjs +4 -1
- package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.d.mts +3 -1
- package/dist/functional/result/impl/result-from-throwable.d.mts.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.mjs +3 -1
- package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-err.d.mts +4 -2
- package/dist/functional/result/impl/result-is-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-err.mjs +4 -2
- package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-ok.d.mts +4 -2
- package/dist/functional/result/impl/result-is-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-ok.mjs +4 -2
- package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-result.d.mts +7 -3
- package/dist/functional/result/impl/result-is-result.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-result.mjs +7 -3
- package/dist/functional/result/impl/result-is-result.mjs.map +1 -1
- package/dist/functional/result/impl/result-map-err.d.mts +3 -0
- package/dist/functional/result/impl/result-map-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-map-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-map.d.mts +4 -0
- package/dist/functional/result/impl/result-map.d.mts.map +1 -1
- package/dist/functional/result/impl/result-map.mjs.map +1 -1
- package/dist/functional/result/impl/result-ok.d.mts +4 -2
- package/dist/functional/result/impl/result-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-ok.mjs +3 -1
- package/dist/functional/result/impl/result-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-or-else.d.mts +4 -0
- package/dist/functional/result/impl/result-or-else.d.mts.map +1 -1
- package/dist/functional/result/impl/result-or-else.mjs.map +1 -1
- package/dist/functional/result/impl/result-swap.d.mts +2 -0
- package/dist/functional/result/impl/result-swap.d.mts.map +1 -1
- package/dist/functional/result/impl/result-swap.mjs +2 -0
- package/dist/functional/result/impl/result-swap.mjs.map +1 -1
- package/dist/functional/result/impl/result-to-optional.d.mts +2 -0
- package/dist/functional/result/impl/result-to-optional.d.mts.map +1 -1
- package/dist/functional/result/impl/result-to-optional.mjs +2 -0
- package/dist/functional/result/impl/result-to-optional.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts +7 -4
- package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +3 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs +3 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.d.mts +3 -2
- package/dist/functional/result/impl/result-unwrap-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.mjs +3 -2
- package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +7 -4
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok.d.mts +3 -2
- package/dist/functional/result/impl/result-unwrap-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.d.mts +3 -1
- package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs +3 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-zip.d.mts +3 -1
- package/dist/functional/result/impl/result-zip.d.mts.map +1 -1
- package/dist/functional/result/impl/result-zip.mjs +3 -1
- package/dist/functional/result/impl/result-zip.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +3 -2
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs +2 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +4 -0
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +3 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +3 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +3 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +3 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +7 -3
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +7 -3
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts +3 -0
- package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts +3 -0
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map.d.mts +6 -0
- package/dist/functional/ternary-result/impl/ternary-result-map.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +2 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts +4 -0
- package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +4 -0
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -1
- package/dist/globals.d.mts +12 -1
- package/dist/guard/has-key.d.mts +6 -3
- package/dist/guard/has-key.d.mts.map +1 -1
- package/dist/guard/has-key.mjs +2 -2
- package/dist/guard/index.mjs +1 -1
- package/dist/guard/is-record.d.mts +31 -0
- package/dist/guard/is-record.d.mts.map +1 -1
- package/dist/guard/is-record.mjs +32 -1
- package/dist/guard/is-record.mjs.map +1 -1
- package/dist/guard/is-type.d.mts +3 -0
- package/dist/guard/is-type.d.mts.map +1 -1
- package/dist/guard/is-type.mjs +3 -0
- package/dist/guard/is-type.mjs.map +1 -1
- package/dist/guard/key-is-in.d.mts +3 -2
- package/dist/guard/key-is-in.d.mts.map +1 -1
- package/dist/guard/key-is-in.mjs +3 -2
- package/dist/guard/key-is-in.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/iterator/range.d.mts +4 -0
- package/dist/iterator/range.d.mts.map +1 -1
- package/dist/iterator/range.mjs +1 -0
- package/dist/iterator/range.mjs.map +1 -1
- package/dist/json/json.d.mts +42 -21
- package/dist/json/json.d.mts.map +1 -1
- package/dist/json/json.mjs +42 -21
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/int.d.mts +33 -19
- package/dist/number/branded-types/int.d.mts.map +1 -1
- package/dist/number/branded-types/int.mjs +33 -19
- package/dist/number/branded-types/int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +2 -2
- package/dist/number/branded-types/positive-int.d.mts +34 -20
- package/dist/number/branded-types/positive-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int.mjs +34 -20
- package/dist/number/branded-types/positive-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-safe-int.d.mts +47 -26
- package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-safe-int.mjs +48 -27
- package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-int.d.mts +48 -27
- package/dist/number/branded-types/safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/safe-int.mjs +50 -29
- package/dist/number/branded-types/safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-uint.mjs +1 -1
- package/dist/number/branded-types/uint.d.mts +31 -19
- package/dist/number/branded-types/uint.d.mts.map +1 -1
- package/dist/number/branded-types/uint.mjs +31 -19
- package/dist/number/branded-types/uint.mjs.map +1 -1
- package/dist/number/num.d.mts +29 -20
- package/dist/number/num.d.mts.map +1 -1
- package/dist/number/num.mjs +24 -17
- package/dist/number/num.mjs.map +1 -1
- package/dist/number/refined-number-utils.d.mts +33 -11
- package/dist/number/refined-number-utils.d.mts.map +1 -1
- package/dist/number/refined-number-utils.mjs +33 -11
- package/dist/number/refined-number-utils.mjs.map +1 -1
- package/dist/object/object.d.mts +12 -3
- package/dist/object/object.d.mts.map +1 -1
- package/dist/object/object.mjs +10 -3
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/map-nullable.mjs.map +1 -1
- package/dist/others/tuple.d.mts +14 -3
- package/dist/others/tuple.d.mts.map +1 -1
- package/dist/others/tuple.mjs +14 -3
- package/dist/others/tuple.mjs.map +1 -1
- package/dist/others/unknown-to-string.d.mts.map +1 -1
- package/dist/others/unknown-to-string.mjs.map +1 -1
- package/dist/promise/promise.d.mts +8 -4
- package/dist/promise/promise.d.mts.map +1 -1
- package/dist/promise/promise.mjs +8 -4
- package/dist/promise/promise.mjs.map +1 -1
- package/package.json +26 -28
- package/src/array/impl/array-utils-creation.mts +20 -0
- package/src/array/impl/array-utils-creation.test.mts +72 -1
- package/src/array/impl/array-utils-element-access.mts +13 -0
- package/src/array/impl/array-utils-element-access.test.mts +36 -15
- package/src/array/impl/array-utils-iterators.test.mts +17 -0
- package/src/array/impl/array-utils-modification.mts +78 -19
- package/src/array/impl/array-utils-modification.test.mts +75 -0
- package/src/array/impl/array-utils-overload-type-error.test.mts +19 -0
- package/src/array/impl/array-utils-reducing-value.mts +61 -16
- package/src/array/impl/array-utils-reducing-value.test.mts +107 -25
- package/src/array/impl/array-utils-search.mts +57 -4
- package/src/array/impl/array-utils-search.test.mts +61 -10
- package/src/array/impl/array-utils-set-op.mts +26 -7
- package/src/array/impl/array-utils-set-op.test.mts +129 -13
- package/src/array/impl/array-utils-size.mts +5 -2
- package/src/array/impl/array-utils-size.test.mts +1 -0
- package/src/array/impl/array-utils-slice-clamped.mts +7 -0
- package/src/array/impl/array-utils-slice-clamped.test.mts +20 -0
- package/src/array/impl/array-utils-slicing.mts +29 -2
- package/src/array/impl/array-utils-slicing.test.mts +57 -0
- package/src/array/impl/array-utils-transformation.mts +58 -0
- package/src/array/impl/array-utils-transformation.test.mts +115 -3
- package/src/array/impl/array-utils-validation.mts +41 -18
- package/src/array/impl/array-utils-validation.test.mts +176 -78
- package/src/array/impl/array.test.mts +18 -6
- package/src/collections/imap-mapped.mts +11 -0
- package/src/collections/imap-mapped.test.mts +86 -18
- package/src/collections/imap.mts +47 -15
- package/src/collections/imap.test.mts +137 -31
- package/src/collections/iset-mapped.mts +54 -19
- package/src/collections/iset-mapped.test.mts +163 -52
- package/src/collections/iset.mts +53 -19
- package/src/collections/iset.test.mts +323 -130
- package/src/collections/queue.mts +78 -25
- package/src/collections/queue.test.mts +65 -35
- package/src/collections/stack.mts +67 -25
- package/src/collections/stack.test.mts +59 -15
- package/src/functional/match.mts +17 -1
- package/src/functional/match.test.mts +2 -0
- package/src/functional/optional/impl/optional-expect-to-be.mts +5 -2
- package/src/functional/optional/impl/optional-filter.mts +6 -0
- package/src/functional/optional/impl/optional-flat-map.mts +4 -0
- package/src/functional/optional/impl/optional-from-nullable.mts +2 -0
- package/src/functional/optional/impl/optional-is-none.mts +1 -1
- package/src/functional/optional/impl/optional-is-optional.mts +4 -2
- package/src/functional/optional/impl/optional-is-some.mts +2 -1
- package/src/functional/optional/impl/optional-map.mts +5 -0
- package/src/functional/optional/impl/optional-none.mts +4 -2
- package/src/functional/optional/impl/optional-or-else.mts +6 -0
- package/src/functional/optional/impl/optional-some.mts +5 -3
- package/src/functional/optional/impl/optional-to-nullable.mts +4 -2
- package/src/functional/optional/impl/optional-unwrap-or.mts +9 -4
- package/src/functional/optional/impl/optional-unwrap-throw.mts +2 -1
- package/src/functional/optional/impl/optional-unwrap.mts +4 -2
- package/src/functional/optional/impl/optional-zip.mts +3 -1
- package/src/functional/optional.test.mts +126 -54
- package/src/functional/pipe.mts +2 -2
- package/src/functional/pipe.test.mts +7 -4
- package/src/functional/result/impl/result-err.mts +4 -2
- package/src/functional/result/impl/result-expect-to-be.mts +5 -2
- package/src/functional/result/impl/result-flat-map.mts +7 -0
- package/src/functional/result/impl/result-fold.mts +6 -0
- package/src/functional/result/impl/result-from-promise.mts +4 -1
- package/src/functional/result/impl/result-from-throwable.mts +5 -1
- package/src/functional/result/impl/result-is-err.mts +4 -2
- package/src/functional/result/impl/result-is-ok.mts +4 -2
- package/src/functional/result/impl/result-is-result.mts +7 -3
- package/src/functional/result/impl/result-map-err.mts +5 -0
- package/src/functional/result/impl/result-map.mts +6 -0
- package/src/functional/result/impl/result-ok.mts +4 -2
- package/src/functional/result/impl/result-or-else.mts +6 -0
- package/src/functional/result/impl/result-swap.mts +2 -0
- package/src/functional/result/impl/result-to-optional.mts +2 -0
- package/src/functional/result/impl/result-unwrap-err-or.mts +9 -4
- package/src/functional/result/impl/result-unwrap-err-throw.mts +3 -1
- package/src/functional/result/impl/result-unwrap-err.mts +3 -2
- package/src/functional/result/impl/result-unwrap-ok-or.mts +9 -4
- package/src/functional/result/impl/result-unwrap-ok.mts +4 -2
- package/src/functional/result/impl/result-unwrap-throw.mts +3 -1
- package/src/functional/result/impl/result-zip.mts +3 -1
- package/src/functional/result.test.mts +182 -152
- package/src/functional/ternary-result/impl/ternary-result-err.mts +3 -2
- package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +4 -0
- package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +7 -0
- package/src/functional/ternary-result/impl/ternary-result-fold.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +3 -1
- package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +4 -1
- package/src/functional/ternary-result/impl/ternary-result-is-ok.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +7 -3
- package/src/functional/ternary-result/impl/ternary-result-is-warn.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-map-err.mts +6 -0
- package/src/functional/ternary-result/impl/ternary-result-map-warn.mts +6 -0
- package/src/functional/ternary-result/impl/ternary-result-map.mts +9 -0
- package/src/functional/ternary-result/impl/ternary-result-ok.mts +1 -1
- package/src/functional/ternary-result/impl/ternary-result-or-else.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-to-optional.mts +2 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-err.mts +2 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-ok.mts +3 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +5 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts +1 -0
- package/src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts +2 -0
- package/src/functional/ternary-result/impl/ternary-result-warn.mts +4 -1
- package/src/functional/ternary-result/impl/ternary-result-zip.mts +4 -0
- package/src/functional/ternary-result.test.mts +99 -8
- package/src/globals.d.mts +12 -1
- package/src/guard/has-key.mts +8 -5
- package/src/guard/has-key.test.mts +9 -5
- package/src/guard/is-error.test.mts +143 -0
- package/src/guard/is-non-empty-string.test.mts +44 -24
- package/src/guard/is-non-null-object.test.mts +45 -26
- package/src/guard/is-primitive.test.mts +51 -28
- package/src/guard/is-record.mts +34 -0
- package/src/guard/is-record.test.mts +28 -7
- package/src/guard/is-type.mts +3 -0
- package/src/guard/is-type.test.mts +285 -155
- package/src/guard/key-is-in.mts +3 -2
- package/src/guard/key-is-in.test.mts +2 -2
- package/src/iterator/range.mts +9 -0
- package/src/json/json.mts +50 -21
- package/src/json/json.test.mts +224 -176
- package/src/number/branded-types/finite-number.test.mts +51 -11
- package/src/number/branded-types/int.mts +33 -19
- package/src/number/branded-types/int.test.mts +56 -14
- package/src/number/branded-types/int16.test.mts +63 -16
- package/src/number/branded-types/int32.test.mts +63 -16
- package/src/number/branded-types/non-negative-finite-number.test.mts +52 -12
- package/src/number/branded-types/non-negative-int16.test.mts +59 -16
- package/src/number/branded-types/non-negative-int32.test.mts +59 -16
- package/src/number/branded-types/non-zero-finite-number.test.mts +65 -14
- package/src/number/branded-types/non-zero-int.test.mts +72 -19
- package/src/number/branded-types/non-zero-int16.test.mts +60 -16
- package/src/number/branded-types/non-zero-int32.test.mts +60 -16
- package/src/number/branded-types/non-zero-safe-int.mts +2 -2
- package/src/number/branded-types/non-zero-safe-int.test.mts +85 -23
- package/src/number/branded-types/non-zero-uint16.test.mts +53 -16
- package/src/number/branded-types/non-zero-uint32.test.mts +53 -16
- package/src/number/branded-types/positive-finite-number.test.mts +59 -14
- package/src/number/branded-types/positive-int.mts +34 -20
- package/src/number/branded-types/positive-int.test.mts +64 -17
- package/src/number/branded-types/positive-int16.test.mts +50 -15
- package/src/number/branded-types/positive-int32.test.mts +50 -15
- package/src/number/branded-types/positive-safe-int.mts +48 -27
- package/src/number/branded-types/positive-safe-int.test.mts +68 -19
- package/src/number/branded-types/positive-uint16.test.mts +53 -16
- package/src/number/branded-types/positive-uint32.test.mts +53 -16
- package/src/number/branded-types/safe-int.mts +50 -29
- package/src/number/branded-types/safe-int.test.mts +70 -18
- package/src/number/branded-types/safe-uint.mts +1 -1
- package/src/number/branded-types/safe-uint.test.mts +65 -17
- package/src/number/branded-types/uint.mts +31 -19
- package/src/number/branded-types/uint.test.mts +58 -15
- package/src/number/branded-types/uint16.test.mts +56 -15
- package/src/number/branded-types/uint32.test.mts +56 -15
- package/src/number/enum/int8.test.mts +7 -1
- package/src/number/enum/uint8.test.mts +7 -1
- package/src/number/num.mts +32 -21
- package/src/number/num.test.mts +88 -26
- package/src/number/refined-number-utils.mts +38 -13
- package/src/object/object.mts +19 -3
- package/src/object/object.test.mts +16 -6
- package/src/others/cast-mutable.test.mts +8 -1
- package/src/others/cast-readonly.test.mts +21 -4
- package/src/others/if-then.test.mts +40 -24
- package/src/others/map-nullable.mts +3 -0
- package/src/others/map-nullable.test.mts +27 -0
- package/src/others/memoize-function.test.mts +41 -0
- package/src/others/tuple.mts +14 -3
- package/src/others/unknown-to-string.mts +2 -0
- package/src/others/unknown-to-string.test.mts +10 -0
- package/src/promise/promise.mts +8 -4
- package/src/promise/promise.test.mts +8 -13
|
@@ -9,9 +9,11 @@ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
|
9
9
|
* @example
|
|
10
10
|
*
|
|
11
11
|
* ```ts
|
|
12
|
-
* assert.
|
|
13
|
-
*
|
|
14
|
-
* assert.
|
|
12
|
+
* assert.isTrue(isInt(5));
|
|
13
|
+
*
|
|
14
|
+
* assert.isFalse(isInt(5.25));
|
|
15
|
+
*
|
|
16
|
+
* assert.isTrue(Int.is(-10));
|
|
15
17
|
* ```
|
|
16
18
|
*
|
|
17
19
|
* @param value - The value to check
|
|
@@ -30,8 +32,9 @@ export declare const isInt: (a: number) => a is Int;
|
|
|
30
32
|
* ```ts
|
|
31
33
|
* const branded = asInt(42);
|
|
32
34
|
*
|
|
33
|
-
* assert(branded === 42);
|
|
34
|
-
*
|
|
35
|
+
* assert.isTrue(branded === 42);
|
|
36
|
+
*
|
|
37
|
+
* assert.isTrue(Int.is(branded));
|
|
35
38
|
* ```
|
|
36
39
|
*
|
|
37
40
|
* @param value - The value to cast
|
|
@@ -63,9 +66,11 @@ export declare const Int: {
|
|
|
63
66
|
* @example
|
|
64
67
|
*
|
|
65
68
|
* ```ts
|
|
66
|
-
* assert.
|
|
67
|
-
*
|
|
68
|
-
* assert.
|
|
69
|
+
* assert.isTrue(isInt(5));
|
|
70
|
+
*
|
|
71
|
+
* assert.isFalse(isInt(5.25));
|
|
72
|
+
*
|
|
73
|
+
* assert.isTrue(Int.is(-10));
|
|
69
74
|
* ```
|
|
70
75
|
*
|
|
71
76
|
* @param value - The value to check
|
|
@@ -84,10 +89,12 @@ export declare const Int: {
|
|
|
84
89
|
*
|
|
85
90
|
* ```ts
|
|
86
91
|
* const negative = asInt(-12);
|
|
92
|
+
*
|
|
87
93
|
* const absolute = Int.abs(negative);
|
|
88
94
|
*
|
|
89
|
-
* assert(absolute === 12);
|
|
90
|
-
*
|
|
95
|
+
* assert.isTrue(absolute === 12);
|
|
96
|
+
*
|
|
97
|
+
* assert.isTrue(Int.is(absolute));
|
|
91
98
|
* ```
|
|
92
99
|
*
|
|
93
100
|
* @param a - The integer value
|
|
@@ -102,7 +109,7 @@ export declare const Int: {
|
|
|
102
109
|
* ```ts
|
|
103
110
|
* const smallest = Int.min(asInt(7), asInt(-3), asInt(2));
|
|
104
111
|
*
|
|
105
|
-
* assert(smallest === -3);
|
|
112
|
+
* assert.isTrue(smallest === -3);
|
|
106
113
|
* ```
|
|
107
114
|
*
|
|
108
115
|
* @param values - The integers to compare (at least one required)
|
|
@@ -117,7 +124,7 @@ export declare const Int: {
|
|
|
117
124
|
* ```ts
|
|
118
125
|
* const largest = Int.max(asInt(7), asInt(-3), asInt(2));
|
|
119
126
|
*
|
|
120
|
-
* assert(largest === 7);
|
|
127
|
+
* assert.isTrue(largest === 7);
|
|
121
128
|
* ```
|
|
122
129
|
*
|
|
123
130
|
* @param values - The integers to compare (at least one required)
|
|
@@ -134,11 +141,14 @@ export declare const Int: {
|
|
|
134
141
|
*
|
|
135
142
|
* ```ts
|
|
136
143
|
* const min = asInt(1);
|
|
144
|
+
*
|
|
137
145
|
* const max = asInt(6);
|
|
146
|
+
*
|
|
138
147
|
* const randomValue = Int.random(min, max);
|
|
139
148
|
*
|
|
140
|
-
* assert.
|
|
141
|
-
*
|
|
149
|
+
* assert.isTrue(Int.is(randomValue));
|
|
150
|
+
*
|
|
151
|
+
* assert.isTrue(randomValue >= 1 && randomValue <= 6);
|
|
142
152
|
* ```
|
|
143
153
|
*
|
|
144
154
|
* @param min - The minimum value (inclusive)
|
|
@@ -153,10 +163,12 @@ export declare const Int: {
|
|
|
153
163
|
*
|
|
154
164
|
* ```ts
|
|
155
165
|
* const base = asInt(2);
|
|
166
|
+
*
|
|
156
167
|
* const exponent = asInt(5);
|
|
168
|
+
*
|
|
157
169
|
* const power = Int.pow(base, exponent);
|
|
158
170
|
*
|
|
159
|
-
* assert(power === 32);
|
|
171
|
+
* assert.isTrue(power === 32);
|
|
160
172
|
* ```
|
|
161
173
|
*
|
|
162
174
|
* @param a - The base integer
|
|
@@ -172,7 +184,7 @@ export declare const Int: {
|
|
|
172
184
|
* ```ts
|
|
173
185
|
* const sum = Int.add(asInt(12), asInt(8));
|
|
174
186
|
*
|
|
175
|
-
* assert(sum === 20);
|
|
187
|
+
* assert.isTrue(sum === 20);
|
|
176
188
|
* ```
|
|
177
189
|
*
|
|
178
190
|
* @param a - First integer
|
|
@@ -188,7 +200,7 @@ export declare const Int: {
|
|
|
188
200
|
* ```ts
|
|
189
201
|
* const difference = Int.sub(asInt(12), asInt(8));
|
|
190
202
|
*
|
|
191
|
-
* assert(difference === 4);
|
|
203
|
+
* assert.isTrue(difference === 4);
|
|
192
204
|
* ```
|
|
193
205
|
*
|
|
194
206
|
* @param a - First integer
|
|
@@ -204,7 +216,7 @@ export declare const Int: {
|
|
|
204
216
|
* ```ts
|
|
205
217
|
* const product = Int.mul(asInt(-4), asInt(6));
|
|
206
218
|
*
|
|
207
|
-
* assert(product === -24);
|
|
219
|
+
* assert.isTrue(product === -24);
|
|
208
220
|
* ```
|
|
209
221
|
*
|
|
210
222
|
* @param a - First integer
|
|
@@ -222,10 +234,12 @@ export declare const Int: {
|
|
|
222
234
|
*
|
|
223
235
|
* ```ts
|
|
224
236
|
* const dividend = asInt(17);
|
|
237
|
+
*
|
|
225
238
|
* const divisor = asInt(5);
|
|
239
|
+
*
|
|
226
240
|
* const quotient = Int.div(dividend, divisor);
|
|
227
241
|
*
|
|
228
|
-
* assert(quotient === 3);
|
|
242
|
+
* assert.isTrue(quotient === 3);
|
|
229
243
|
* ```
|
|
230
244
|
*
|
|
231
245
|
* @param a - The dividend
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA6BnE
|
|
1
|
+
{"version":3,"file":"int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA6BnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK,yBAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,KAAK;;;;;;MAAW,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG;IACd;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;;;;;;;;CAEK,CAAC"}
|
|
@@ -17,9 +17,11 @@ const { abs, add, castType, div, is, max: max_, min: min_, mul, pow, random, sub
|
|
|
17
17
|
* @example
|
|
18
18
|
*
|
|
19
19
|
* ```ts
|
|
20
|
-
* assert.
|
|
21
|
-
*
|
|
22
|
-
* assert.
|
|
20
|
+
* assert.isTrue(isInt(5));
|
|
21
|
+
*
|
|
22
|
+
* assert.isFalse(isInt(5.25));
|
|
23
|
+
*
|
|
24
|
+
* assert.isTrue(Int.is(-10));
|
|
23
25
|
* ```
|
|
24
26
|
*
|
|
25
27
|
* @param value - The value to check
|
|
@@ -38,8 +40,9 @@ const isInt = is;
|
|
|
38
40
|
* ```ts
|
|
39
41
|
* const branded = asInt(42);
|
|
40
42
|
*
|
|
41
|
-
* assert(branded === 42);
|
|
42
|
-
*
|
|
43
|
+
* assert.isTrue(branded === 42);
|
|
44
|
+
*
|
|
45
|
+
* assert.isTrue(Int.is(branded));
|
|
43
46
|
* ```
|
|
44
47
|
*
|
|
45
48
|
* @param value - The value to cast
|
|
@@ -65,9 +68,11 @@ const Int = {
|
|
|
65
68
|
* @example
|
|
66
69
|
*
|
|
67
70
|
* ```ts
|
|
68
|
-
* assert.
|
|
69
|
-
*
|
|
70
|
-
* assert.
|
|
71
|
+
* assert.isTrue(isInt(5));
|
|
72
|
+
*
|
|
73
|
+
* assert.isFalse(isInt(5.25));
|
|
74
|
+
*
|
|
75
|
+
* assert.isTrue(Int.is(-10));
|
|
71
76
|
* ```
|
|
72
77
|
*
|
|
73
78
|
* @param value - The value to check
|
|
@@ -86,10 +91,12 @@ const Int = {
|
|
|
86
91
|
*
|
|
87
92
|
* ```ts
|
|
88
93
|
* const negative = asInt(-12);
|
|
94
|
+
*
|
|
89
95
|
* const absolute = Int.abs(negative);
|
|
90
96
|
*
|
|
91
|
-
* assert(absolute === 12);
|
|
92
|
-
*
|
|
97
|
+
* assert.isTrue(absolute === 12);
|
|
98
|
+
*
|
|
99
|
+
* assert.isTrue(Int.is(absolute));
|
|
93
100
|
* ```
|
|
94
101
|
*
|
|
95
102
|
* @param a - The integer value
|
|
@@ -104,7 +111,7 @@ const Int = {
|
|
|
104
111
|
* ```ts
|
|
105
112
|
* const smallest = Int.min(asInt(7), asInt(-3), asInt(2));
|
|
106
113
|
*
|
|
107
|
-
* assert(smallest === -3);
|
|
114
|
+
* assert.isTrue(smallest === -3);
|
|
108
115
|
* ```
|
|
109
116
|
*
|
|
110
117
|
* @param values - The integers to compare (at least one required)
|
|
@@ -119,7 +126,7 @@ const Int = {
|
|
|
119
126
|
* ```ts
|
|
120
127
|
* const largest = Int.max(asInt(7), asInt(-3), asInt(2));
|
|
121
128
|
*
|
|
122
|
-
* assert(largest === 7);
|
|
129
|
+
* assert.isTrue(largest === 7);
|
|
123
130
|
* ```
|
|
124
131
|
*
|
|
125
132
|
* @param values - The integers to compare (at least one required)
|
|
@@ -136,11 +143,14 @@ const Int = {
|
|
|
136
143
|
*
|
|
137
144
|
* ```ts
|
|
138
145
|
* const min = asInt(1);
|
|
146
|
+
*
|
|
139
147
|
* const max = asInt(6);
|
|
148
|
+
*
|
|
140
149
|
* const randomValue = Int.random(min, max);
|
|
141
150
|
*
|
|
142
|
-
* assert.
|
|
143
|
-
*
|
|
151
|
+
* assert.isTrue(Int.is(randomValue));
|
|
152
|
+
*
|
|
153
|
+
* assert.isTrue(randomValue >= 1 && randomValue <= 6);
|
|
144
154
|
* ```
|
|
145
155
|
*
|
|
146
156
|
* @param min - The minimum value (inclusive)
|
|
@@ -155,10 +165,12 @@ const Int = {
|
|
|
155
165
|
*
|
|
156
166
|
* ```ts
|
|
157
167
|
* const base = asInt(2);
|
|
168
|
+
*
|
|
158
169
|
* const exponent = asInt(5);
|
|
170
|
+
*
|
|
159
171
|
* const power = Int.pow(base, exponent);
|
|
160
172
|
*
|
|
161
|
-
* assert(power === 32);
|
|
173
|
+
* assert.isTrue(power === 32);
|
|
162
174
|
* ```
|
|
163
175
|
*
|
|
164
176
|
* @param a - The base integer
|
|
@@ -174,7 +186,7 @@ const Int = {
|
|
|
174
186
|
* ```ts
|
|
175
187
|
* const sum = Int.add(asInt(12), asInt(8));
|
|
176
188
|
*
|
|
177
|
-
* assert(sum === 20);
|
|
189
|
+
* assert.isTrue(sum === 20);
|
|
178
190
|
* ```
|
|
179
191
|
*
|
|
180
192
|
* @param a - First integer
|
|
@@ -190,7 +202,7 @@ const Int = {
|
|
|
190
202
|
* ```ts
|
|
191
203
|
* const difference = Int.sub(asInt(12), asInt(8));
|
|
192
204
|
*
|
|
193
|
-
* assert(difference === 4);
|
|
205
|
+
* assert.isTrue(difference === 4);
|
|
194
206
|
* ```
|
|
195
207
|
*
|
|
196
208
|
* @param a - First integer
|
|
@@ -206,7 +218,7 @@ const Int = {
|
|
|
206
218
|
* ```ts
|
|
207
219
|
* const product = Int.mul(asInt(-4), asInt(6));
|
|
208
220
|
*
|
|
209
|
-
* assert(product === -24);
|
|
221
|
+
* assert.isTrue(product === -24);
|
|
210
222
|
* ```
|
|
211
223
|
*
|
|
212
224
|
* @param a - First integer
|
|
@@ -224,10 +236,12 @@ const Int = {
|
|
|
224
236
|
*
|
|
225
237
|
* ```ts
|
|
226
238
|
* const dividend = asInt(17);
|
|
239
|
+
*
|
|
227
240
|
* const divisor = asInt(5);
|
|
241
|
+
*
|
|
228
242
|
* const quotient = Int.div(dividend, divisor);
|
|
229
243
|
*
|
|
230
|
-
* assert(quotient === 3);
|
|
244
|
+
* assert.isTrue(quotient === 3);
|
|
231
245
|
* ```
|
|
232
246
|
*
|
|
233
247
|
* @param a - The dividend
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int.mjs","sources":["../../../src/number/branded-types/int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,YAAY;AAEtC,MAAM,EACJ,GAAG,EACH,GAAG,EACH,QAAQ,EACR,GAAG,EACH,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;AACA,IAAA,oBAAoB,EAAE,SAAS;AAC/B,IAAA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;AACT,CAAA,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"int.mjs","sources":["../../../src/number/branded-types/int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,YAAY;AAEtC,MAAM,EACJ,GAAG,EACH,GAAG,EACH,QAAQ,EACR,GAAG,EACH,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;AACA,IAAA,oBAAoB,EAAE,SAAS;AAC/B,IAAA,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS;IAC5B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;;;;;;;;;;;;;;AAmBG;AACI,MAAM,KAAK,GAAG;AAErB;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,KAAK,GAAG;AAErB;;;;;;;;;;AAUG;AACI,MAAM,GAAG,GAAG;AACjB;;;;;;;;;;;;;;;;AAgBG;IACH,EAAE;AAEF;;;;;;;;;;;;;;;;;;;;;AAqBG;IACH,GAAG;AAEH;;;;;;;;;;;;;AAaG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;AAaG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;;;;;;;AAuBG;IACH,MAAM;AAEN;;;;;;;;;;;;;;;;;;AAkBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;;;;;AAqBG;IACH,GAAG;;;;;"}
|
|
@@ -4,9 +4,9 @@ const typeNameInMessage = 'a non-zero safe integer';
|
|
|
4
4
|
const { MAX_VALUE, MIN_VALUE, abs, add, castType, clamp, div, is, max: max_, min: min_, mul, pow, randomNonZero: random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
5
|
integerOrSafeInteger: 'SafeInteger',
|
|
6
6
|
nonZero: true,
|
|
7
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
7
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion, math/prefer-number-min-safe-integer
|
|
8
8
|
MIN_VALUE: Number.MIN_SAFE_INTEGER,
|
|
9
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
9
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion, math/prefer-number-max-safe-integer
|
|
10
10
|
MAX_VALUE: Number.MAX_SAFE_INTEGER,
|
|
11
11
|
typeNameInMessage,
|
|
12
12
|
});
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* @example
|
|
8
8
|
*
|
|
9
9
|
* ```ts
|
|
10
|
-
* assert.
|
|
11
|
-
*
|
|
12
|
-
* assert.
|
|
10
|
+
* assert.isTrue(isPositiveInt(5));
|
|
11
|
+
*
|
|
12
|
+
* assert.isFalse(isPositiveInt(0));
|
|
13
|
+
*
|
|
14
|
+
* assert.isTrue(PositiveInt.is(10));
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
15
17
|
* @param value - The value to check
|
|
@@ -28,8 +30,9 @@ export declare const isPositiveInt: (a: number) => a is PositiveInt;
|
|
|
28
30
|
* ```ts
|
|
29
31
|
* const branded = asPositiveInt(7);
|
|
30
32
|
*
|
|
31
|
-
* assert(branded === 7);
|
|
32
|
-
*
|
|
33
|
+
* assert.isTrue(branded === 7);
|
|
34
|
+
*
|
|
35
|
+
* assert.isTrue(PositiveInt.is(branded));
|
|
33
36
|
* ```
|
|
34
37
|
*
|
|
35
38
|
* @param value - The value to cast
|
|
@@ -72,9 +75,11 @@ export declare const PositiveInt: {
|
|
|
72
75
|
* @example
|
|
73
76
|
*
|
|
74
77
|
* ```ts
|
|
75
|
-
* assert.
|
|
76
|
-
*
|
|
77
|
-
* assert.
|
|
78
|
+
* assert.isTrue(isPositiveInt(5));
|
|
79
|
+
*
|
|
80
|
+
* assert.isFalse(isPositiveInt(0));
|
|
81
|
+
*
|
|
82
|
+
* assert.isTrue(PositiveInt.is(10));
|
|
78
83
|
* ```
|
|
79
84
|
*
|
|
80
85
|
* @param value - The value to check
|
|
@@ -103,7 +108,7 @@ export declare const PositiveInt: {
|
|
|
103
108
|
* asPositiveInt(12),
|
|
104
109
|
* );
|
|
105
110
|
*
|
|
106
|
-
* assert(smallest === 3);
|
|
111
|
+
* assert.isTrue(smallest === 3);
|
|
107
112
|
* ```
|
|
108
113
|
*
|
|
109
114
|
* @param values - The positive integers to compare (at least one required)
|
|
@@ -122,7 +127,7 @@ export declare const PositiveInt: {
|
|
|
122
127
|
* asPositiveInt(12),
|
|
123
128
|
* );
|
|
124
129
|
*
|
|
125
|
-
* assert(largest === 12);
|
|
130
|
+
* assert.isTrue(largest === 12);
|
|
126
131
|
* ```
|
|
127
132
|
*
|
|
128
133
|
* @param values - The positive integers to compare (at least one required)
|
|
@@ -139,10 +144,12 @@ export declare const PositiveInt: {
|
|
|
139
144
|
*
|
|
140
145
|
* ```ts
|
|
141
146
|
* const belowRange = PositiveInt.clamp(0);
|
|
147
|
+
*
|
|
142
148
|
* const withinRange = PositiveInt.clamp(10);
|
|
143
149
|
*
|
|
144
|
-
* assert(belowRange === 1);
|
|
145
|
-
*
|
|
150
|
+
* assert.isTrue(belowRange === 1);
|
|
151
|
+
*
|
|
152
|
+
* assert.isTrue(withinRange === 10);
|
|
146
153
|
* ```
|
|
147
154
|
*
|
|
148
155
|
* @param value - The number to clamp
|
|
@@ -159,11 +166,14 @@ export declare const PositiveInt: {
|
|
|
159
166
|
*
|
|
160
167
|
* ```ts
|
|
161
168
|
* const min = asPositiveInt(3);
|
|
169
|
+
*
|
|
162
170
|
* const max = asPositiveInt(6);
|
|
171
|
+
*
|
|
163
172
|
* const randomValue = PositiveInt.random(min, max);
|
|
164
173
|
*
|
|
165
|
-
* assert.
|
|
166
|
-
*
|
|
174
|
+
* assert.isTrue(PositiveInt.is(randomValue));
|
|
175
|
+
*
|
|
176
|
+
* assert.isTrue(randomValue >= 3 && randomValue <= 6);
|
|
167
177
|
* ```
|
|
168
178
|
*
|
|
169
179
|
* @param min - The minimum value (inclusive, must be >= 1)
|
|
@@ -179,10 +189,12 @@ export declare const PositiveInt: {
|
|
|
179
189
|
*
|
|
180
190
|
* ```ts
|
|
181
191
|
* const base = asPositiveInt(2);
|
|
192
|
+
*
|
|
182
193
|
* const exponent = asPositiveInt(4);
|
|
194
|
+
*
|
|
183
195
|
* const power = PositiveInt.pow(base, exponent);
|
|
184
196
|
*
|
|
185
|
-
* assert(power === 16);
|
|
197
|
+
* assert.isTrue(power === 16);
|
|
186
198
|
* ```
|
|
187
199
|
*
|
|
188
200
|
* @param a - The base positive integer
|
|
@@ -198,7 +210,7 @@ export declare const PositiveInt: {
|
|
|
198
210
|
* ```ts
|
|
199
211
|
* const sum = PositiveInt.add(asPositiveInt(4), asPositiveInt(5));
|
|
200
212
|
*
|
|
201
|
-
* assert(sum === 9);
|
|
213
|
+
* assert.isTrue(sum === 9);
|
|
202
214
|
* ```
|
|
203
215
|
*
|
|
204
216
|
* @param a - First positive integer
|
|
@@ -217,7 +229,7 @@ export declare const PositiveInt: {
|
|
|
217
229
|
* ```ts
|
|
218
230
|
* const difference = PositiveInt.sub(asPositiveInt(5), asPositiveInt(7));
|
|
219
231
|
*
|
|
220
|
-
* assert(difference === 1);
|
|
232
|
+
* assert.isTrue(difference === 1);
|
|
221
233
|
* ```
|
|
222
234
|
*
|
|
223
235
|
* @param a - The minuend (positive integer)
|
|
@@ -233,7 +245,7 @@ export declare const PositiveInt: {
|
|
|
233
245
|
* ```ts
|
|
234
246
|
* const product = PositiveInt.mul(asPositiveInt(3), asPositiveInt(7));
|
|
235
247
|
*
|
|
236
|
-
* assert(product === 21);
|
|
248
|
+
* assert.isTrue(product === 21);
|
|
237
249
|
* ```
|
|
238
250
|
*
|
|
239
251
|
* @param a - First positive integer
|
|
@@ -253,10 +265,12 @@ export declare const PositiveInt: {
|
|
|
253
265
|
*
|
|
254
266
|
* ```ts
|
|
255
267
|
* const quotient = PositiveInt.div(asPositiveInt(9), asPositiveInt(2));
|
|
268
|
+
*
|
|
256
269
|
* const clamped = PositiveInt.div(asPositiveInt(3), asPositiveInt(10));
|
|
257
270
|
*
|
|
258
|
-
* assert(quotient === 4);
|
|
259
|
-
*
|
|
271
|
+
* assert.isTrue(quotient === 4);
|
|
272
|
+
*
|
|
273
|
+
* assert.isTrue(clamped === 1);
|
|
260
274
|
* ```
|
|
261
275
|
*
|
|
262
276
|
* @param a - The dividend (positive integer)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int.mts"],"names":[],"mappings":"AA+BA
|
|
1
|
+
{"version":3,"file":"positive-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int.mts"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,iCAAK,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;MAAW,CAAC;AAEtC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW;IACtB;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;OAIG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -16,9 +16,11 @@ const { MIN_VALUE, add, castType, clamp, div, is, max: max_, min: min_, mul, pow
|
|
|
16
16
|
* @example
|
|
17
17
|
*
|
|
18
18
|
* ```ts
|
|
19
|
-
* assert.
|
|
20
|
-
*
|
|
21
|
-
* assert.
|
|
19
|
+
* assert.isTrue(isPositiveInt(5));
|
|
20
|
+
*
|
|
21
|
+
* assert.isFalse(isPositiveInt(0));
|
|
22
|
+
*
|
|
23
|
+
* assert.isTrue(PositiveInt.is(10));
|
|
22
24
|
* ```
|
|
23
25
|
*
|
|
24
26
|
* @param value - The value to check
|
|
@@ -37,8 +39,9 @@ const isPositiveInt = is;
|
|
|
37
39
|
* ```ts
|
|
38
40
|
* const branded = asPositiveInt(7);
|
|
39
41
|
*
|
|
40
|
-
* assert(branded === 7);
|
|
41
|
-
*
|
|
42
|
+
* assert.isTrue(branded === 7);
|
|
43
|
+
*
|
|
44
|
+
* assert.isTrue(PositiveInt.is(branded));
|
|
42
45
|
* ```
|
|
43
46
|
*
|
|
44
47
|
* @param value - The value to cast
|
|
@@ -69,9 +72,11 @@ const PositiveInt = {
|
|
|
69
72
|
* @example
|
|
70
73
|
*
|
|
71
74
|
* ```ts
|
|
72
|
-
* assert.
|
|
73
|
-
*
|
|
74
|
-
* assert.
|
|
75
|
+
* assert.isTrue(isPositiveInt(5));
|
|
76
|
+
*
|
|
77
|
+
* assert.isFalse(isPositiveInt(0));
|
|
78
|
+
*
|
|
79
|
+
* assert.isTrue(PositiveInt.is(10));
|
|
75
80
|
* ```
|
|
76
81
|
*
|
|
77
82
|
* @param value - The value to check
|
|
@@ -100,7 +105,7 @@ const PositiveInt = {
|
|
|
100
105
|
* asPositiveInt(12),
|
|
101
106
|
* );
|
|
102
107
|
*
|
|
103
|
-
* assert(smallest === 3);
|
|
108
|
+
* assert.isTrue(smallest === 3);
|
|
104
109
|
* ```
|
|
105
110
|
*
|
|
106
111
|
* @param values - The positive integers to compare (at least one required)
|
|
@@ -119,7 +124,7 @@ const PositiveInt = {
|
|
|
119
124
|
* asPositiveInt(12),
|
|
120
125
|
* );
|
|
121
126
|
*
|
|
122
|
-
* assert(largest === 12);
|
|
127
|
+
* assert.isTrue(largest === 12);
|
|
123
128
|
* ```
|
|
124
129
|
*
|
|
125
130
|
* @param values - The positive integers to compare (at least one required)
|
|
@@ -136,10 +141,12 @@ const PositiveInt = {
|
|
|
136
141
|
*
|
|
137
142
|
* ```ts
|
|
138
143
|
* const belowRange = PositiveInt.clamp(0);
|
|
144
|
+
*
|
|
139
145
|
* const withinRange = PositiveInt.clamp(10);
|
|
140
146
|
*
|
|
141
|
-
* assert(belowRange === 1);
|
|
142
|
-
*
|
|
147
|
+
* assert.isTrue(belowRange === 1);
|
|
148
|
+
*
|
|
149
|
+
* assert.isTrue(withinRange === 10);
|
|
143
150
|
* ```
|
|
144
151
|
*
|
|
145
152
|
* @param value - The number to clamp
|
|
@@ -156,11 +163,14 @@ const PositiveInt = {
|
|
|
156
163
|
*
|
|
157
164
|
* ```ts
|
|
158
165
|
* const min = asPositiveInt(3);
|
|
166
|
+
*
|
|
159
167
|
* const max = asPositiveInt(6);
|
|
168
|
+
*
|
|
160
169
|
* const randomValue = PositiveInt.random(min, max);
|
|
161
170
|
*
|
|
162
|
-
* assert.
|
|
163
|
-
*
|
|
171
|
+
* assert.isTrue(PositiveInt.is(randomValue));
|
|
172
|
+
*
|
|
173
|
+
* assert.isTrue(randomValue >= 3 && randomValue <= 6);
|
|
164
174
|
* ```
|
|
165
175
|
*
|
|
166
176
|
* @param min - The minimum value (inclusive, must be >= 1)
|
|
@@ -176,10 +186,12 @@ const PositiveInt = {
|
|
|
176
186
|
*
|
|
177
187
|
* ```ts
|
|
178
188
|
* const base = asPositiveInt(2);
|
|
189
|
+
*
|
|
179
190
|
* const exponent = asPositiveInt(4);
|
|
191
|
+
*
|
|
180
192
|
* const power = PositiveInt.pow(base, exponent);
|
|
181
193
|
*
|
|
182
|
-
* assert(power === 16);
|
|
194
|
+
* assert.isTrue(power === 16);
|
|
183
195
|
* ```
|
|
184
196
|
*
|
|
185
197
|
* @param a - The base positive integer
|
|
@@ -195,7 +207,7 @@ const PositiveInt = {
|
|
|
195
207
|
* ```ts
|
|
196
208
|
* const sum = PositiveInt.add(asPositiveInt(4), asPositiveInt(5));
|
|
197
209
|
*
|
|
198
|
-
* assert(sum === 9);
|
|
210
|
+
* assert.isTrue(sum === 9);
|
|
199
211
|
* ```
|
|
200
212
|
*
|
|
201
213
|
* @param a - First positive integer
|
|
@@ -214,7 +226,7 @@ const PositiveInt = {
|
|
|
214
226
|
* ```ts
|
|
215
227
|
* const difference = PositiveInt.sub(asPositiveInt(5), asPositiveInt(7));
|
|
216
228
|
*
|
|
217
|
-
* assert(difference === 1);
|
|
229
|
+
* assert.isTrue(difference === 1);
|
|
218
230
|
* ```
|
|
219
231
|
*
|
|
220
232
|
* @param a - The minuend (positive integer)
|
|
@@ -230,7 +242,7 @@ const PositiveInt = {
|
|
|
230
242
|
* ```ts
|
|
231
243
|
* const product = PositiveInt.mul(asPositiveInt(3), asPositiveInt(7));
|
|
232
244
|
*
|
|
233
|
-
* assert(product === 21);
|
|
245
|
+
* assert.isTrue(product === 21);
|
|
234
246
|
* ```
|
|
235
247
|
*
|
|
236
248
|
* @param a - First positive integer
|
|
@@ -250,10 +262,12 @@ const PositiveInt = {
|
|
|
250
262
|
*
|
|
251
263
|
* ```ts
|
|
252
264
|
* const quotient = PositiveInt.div(asPositiveInt(9), asPositiveInt(2));
|
|
265
|
+
*
|
|
253
266
|
* const clamped = PositiveInt.div(asPositiveInt(3), asPositiveInt(10));
|
|
254
267
|
*
|
|
255
|
-
* assert(quotient === 4);
|
|
256
|
-
*
|
|
268
|
+
* assert.isTrue(quotient === 4);
|
|
269
|
+
*
|
|
270
|
+
* assert.isTrue(clamped === 1);
|
|
257
271
|
* ```
|
|
258
272
|
*
|
|
259
273
|
* @param a - The dividend (positive integer)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-int.mjs","sources":["../../../src/number/branded-types/positive-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,oBAAoB;AAE9C,MAAM,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,KAAK,EACL,GAAG,EACH,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;AACA,IAAA,oBAAoB,EAAE,SAAS;AAC/B,IAAA,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;AACT,CAAA,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"positive-int.mjs","sources":["../../../src/number/branded-types/positive-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,oBAAoB;AAE9C,MAAM,EACJ,SAAS,EACT,GAAG,EACH,QAAQ,EACR,KAAK,EACL,GAAG,EACH,EAAE,EACF,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,mBAAmB,CAI7D;AACA,IAAA,oBAAoB,EAAE,SAAS;AAC/B,IAAA,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,aAAa,GAAG;AAE7B;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,aAAa,GAAG;AAE7B;;;;;;;;;;;;;;;AAeG;AACI,MAAM,WAAW,GAAG;AACzB;;;;;;;;;;;;;;;;AAgBG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;;;;;;;;;;;;;;;;;AAoBG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;AAiBG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;;;;AAoBG;IACH,KAAK;AAEL;;;;;;;;;;;;;;;;;;;;;;;AAuBG;IACH,MAAM;AAEN;;;;;;;;;;;;;;;;;;;AAmBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;AAiBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;;;;;;;AAuBG;IACH,GAAG;;;;;"}
|