ts-data-forge 5.0.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -6
- 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 +26 -2
- 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 +30 -0
- 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 +13 -0
- package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
- package/dist/array/impl/array-utils-set-op.mjs +13 -0
- package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
- package/dist/array/impl/array-utils-size.d.mts +3 -0
- package/dist/array/impl/array-utils-size.d.mts.map +1 -1
- package/dist/array/impl/array-utils-size.mjs +3 -0
- 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 +15 -0
- package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slicing.mjs +7 -0
- 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 +17 -0
- package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +11 -0
- 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 +20 -0
- package/dist/collections/imap.d.mts.map +1 -1
- package/dist/collections/imap.mjs +2 -0
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/iset-mapped.d.mts +27 -0
- package/dist/collections/iset-mapped.d.mts.map +1 -1
- package/dist/collections/iset-mapped.mjs +7 -0
- package/dist/collections/iset-mapped.mjs.map +1 -1
- package/dist/collections/iset.d.mts +29 -0
- package/dist/collections/iset.d.mts.map +1 -1
- package/dist/collections/iset.mjs +7 -0
- package/dist/collections/iset.mjs.map +1 -1
- package/dist/collections/queue.d.mts +40 -0
- package/dist/collections/queue.d.mts.map +1 -1
- package/dist/collections/queue.mjs +8 -0
- package/dist/collections/queue.mjs.map +1 -1
- package/dist/collections/stack.d.mts +35 -0
- package/dist/collections/stack.d.mts.map +1 -1
- package/dist/collections/stack.mjs +7 -0
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/entry-point.mjs +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 +1 -0
- 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-optional.d.mts +2 -0
- package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-optional.mjs +2 -0
- package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.d.mts +1 -0
- package/dist/functional/optional/impl/optional-is-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.mjs +1 -0
- 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 +2 -0
- package/dist/functional/optional/impl/optional-none.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-none.mjs +2 -0
- 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 +3 -1
- package/dist/functional/optional/impl/optional-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-some.mjs +2 -0
- package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.d.mts +2 -0
- package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.mjs +2 -0
- package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.d.mts +3 -0
- 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 +1 -0
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs +1 -0
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap.d.mts +2 -0
- 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 +2 -0
- package/dist/functional/optional/impl/optional-zip.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-zip.mjs +2 -0
- package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
- package/dist/functional/result/impl/result-err.d.mts +3 -1
- package/dist/functional/result/impl/result-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-err.mjs +2 -0
- package/dist/functional/result/impl/result-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.d.mts +1 -0
- 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 +3 -0
- package/dist/functional/result/impl/result-from-promise.d.mts.map +1 -1
- package/dist/functional/result/impl/result-from-promise.mjs +3 -0
- package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.d.mts +2 -0
- package/dist/functional/result/impl/result-from-throwable.d.mts.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.mjs +2 -0
- package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-err.d.mts +2 -0
- package/dist/functional/result/impl/result-is-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-err.mjs +2 -0
- package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-ok.d.mts +2 -0
- package/dist/functional/result/impl/result-is-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-ok.mjs +2 -0
- package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-result.d.mts +4 -0
- package/dist/functional/result/impl/result-is-result.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-result.mjs +4 -0
- 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 +3 -1
- package/dist/functional/result/impl/result-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-ok.mjs +2 -0
- 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 +3 -0
- 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 +2 -0
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs +2 -0
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.d.mts +1 -0
- package/dist/functional/result/impl/result-unwrap-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.mjs +1 -0
- package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +3 -0
- 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 +1 -0
- 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 +2 -0
- package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs +2 -0
- 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 +2 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs +1 -0
- 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 +2 -0
- 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 +2 -0
- 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 +2 -0
- 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 +2 -0
- 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 +4 -0
- 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 +4 -0
- 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 +10 -0
- 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 +1 -0
- package/dist/guard/key-is-in.d.mts.map +1 -1
- package/dist/guard/key-is-in.mjs +1 -0
- 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 +21 -0
- package/dist/json/json.d.mts.map +1 -1
- package/dist/json/json.mjs +21 -0
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/int.d.mts +14 -0
- package/dist/number/branded-types/int.d.mts.map +1 -1
- package/dist/number/branded-types/int.mjs +14 -0
- 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 +14 -0
- package/dist/number/branded-types/positive-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int.mjs +14 -0
- package/dist/number/branded-types/positive-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-safe-int.d.mts +21 -0
- package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-safe-int.mjs +22 -1
- package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-int.d.mts +21 -0
- package/dist/number/branded-types/safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/safe-int.mjs +23 -2
- 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 +12 -0
- package/dist/number/branded-types/uint.d.mts.map +1 -1
- package/dist/number/branded-types/uint.mjs +12 -0
- package/dist/number/branded-types/uint.mjs.map +1 -1
- package/dist/number/num.d.mts +9 -0
- package/dist/number/num.d.mts.map +1 -1
- package/dist/number/num.mjs +8 -1
- package/dist/number/num.mjs.map +1 -1
- package/dist/number/refined-number-utils.d.mts +22 -0
- package/dist/number/refined-number-utils.d.mts.map +1 -1
- package/dist/number/refined-number-utils.mjs +22 -0
- package/dist/number/refined-number-utils.mjs.map +1 -1
- package/dist/object/object.d.mts +9 -0
- package/dist/object/object.d.mts.map +1 -1
- package/dist/object/object.mjs +7 -0
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/map-nullable.mjs.map +1 -1
- package/dist/others/tuple.d.mts +11 -0
- package/dist/others/tuple.d.mts.map +1 -1
- package/dist/others/tuple.mjs +11 -0
- 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 +4 -0
- package/dist/promise/promise.d.mts.map +1 -1
- package/dist/promise/promise.mjs +4 -0
- package/dist/promise/promise.mjs.map +1 -1
- package/package.json +18 -22
- package/src/array/impl/array-utils-creation.mts +20 -0
- package/src/array/impl/array-utils-creation.test.mts +71 -0
- package/src/array/impl/array-utils-element-access.mts +13 -0
- package/src/array/impl/array-utils-element-access.test.mts +21 -0
- package/src/array/impl/array-utils-iterators.test.mts +17 -0
- package/src/array/impl/array-utils-modification.mts +40 -0
- 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 +53 -8
- package/src/array/impl/array-utils-reducing-value.test.mts +90 -0
- package/src/array/impl/array-utils-search.mts +53 -0
- package/src/array/impl/array-utils-search.test.mts +51 -0
- package/src/array/impl/array-utils-set-op.mts +19 -0
- package/src/array/impl/array-utils-set-op.test.mts +116 -0
- package/src/array/impl/array-utils-size.mts +3 -0
- 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 +27 -0
- 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 +113 -1
- package/src/array/impl/array-utils-validation.mts +23 -0
- package/src/array/impl/array-utils-validation.test.mts +96 -0
- package/src/array/impl/array.test.mts +12 -0
- package/src/collections/imap-mapped.mts +11 -0
- package/src/collections/imap-mapped.test.mts +70 -0
- package/src/collections/imap.mts +32 -0
- package/src/collections/imap.test.mts +106 -0
- package/src/collections/iset-mapped.mts +35 -0
- package/src/collections/iset-mapped.test.mts +111 -0
- package/src/collections/iset.mts +34 -0
- package/src/collections/iset.test.mts +193 -0
- package/src/collections/queue.mts +53 -0
- package/src/collections/queue.test.mts +32 -0
- package/src/collections/stack.mts +42 -0
- package/src/collections/stack.test.mts +44 -0
- package/src/functional/match.mts +16 -0
- package/src/functional/match.test.mts +2 -0
- package/src/functional/optional/impl/optional-expect-to-be.mts +3 -0
- 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-optional.mts +2 -0
- package/src/functional/optional/impl/optional-is-some.mts +1 -0
- package/src/functional/optional/impl/optional-map.mts +5 -0
- package/src/functional/optional/impl/optional-none.mts +2 -0
- package/src/functional/optional/impl/optional-or-else.mts +6 -0
- package/src/functional/optional/impl/optional-some.mts +3 -1
- package/src/functional/optional/impl/optional-to-nullable.mts +2 -0
- package/src/functional/optional/impl/optional-unwrap-or.mts +5 -0
- package/src/functional/optional/impl/optional-unwrap-throw.mts +1 -0
- package/src/functional/optional/impl/optional-unwrap.mts +2 -0
- package/src/functional/optional/impl/optional-zip.mts +2 -0
- package/src/functional/optional.test.mts +73 -0
- package/src/functional/pipe.test.mts +3 -0
- package/src/functional/result/impl/result-err.mts +3 -1
- package/src/functional/result/impl/result-expect-to-be.mts +3 -0
- 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 +3 -0
- package/src/functional/result/impl/result-from-throwable.mts +4 -0
- package/src/functional/result/impl/result-is-err.mts +2 -0
- package/src/functional/result/impl/result-is-ok.mts +2 -0
- package/src/functional/result/impl/result-is-result.mts +4 -0
- 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 +3 -1
- 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 +5 -0
- package/src/functional/result/impl/result-unwrap-err-throw.mts +2 -0
- package/src/functional/result/impl/result-unwrap-err.mts +1 -0
- package/src/functional/result/impl/result-unwrap-ok-or.mts +5 -0
- package/src/functional/result/impl/result-unwrap-ok.mts +2 -0
- package/src/functional/result/impl/result-unwrap-throw.mts +2 -0
- package/src/functional/result/impl/result-zip.mts +3 -1
- package/src/functional/result.test.mts +88 -0
- package/src/functional/ternary-result/impl/ternary-result-err.mts +2 -1
- 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 +2 -0
- package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +3 -0
- 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 +4 -0
- 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 +91 -0
- package/src/globals.d.mts +10 -0
- package/src/guard/has-key.test.mts +9 -0
- package/src/guard/is-non-empty-string.test.mts +20 -0
- package/src/guard/is-non-null-object.test.mts +19 -0
- package/src/guard/is-primitive.test.mts +23 -0
- package/src/guard/is-record.mts +34 -0
- package/src/guard/is-record.test.mts +21 -0
- package/src/guard/is-type.mts +3 -0
- package/src/guard/is-type.test.mts +134 -0
- package/src/guard/key-is-in.mts +1 -0
- package/src/iterator/range.mts +9 -0
- package/src/json/json.mts +29 -0
- package/src/json/json.test.mts +87 -0
- package/src/number/branded-types/finite-number.test.mts +38 -0
- package/src/number/branded-types/int.mts +14 -0
- package/src/number/branded-types/int.test.mts +42 -0
- package/src/number/branded-types/int16.test.mts +47 -0
- package/src/number/branded-types/int32.test.mts +47 -0
- package/src/number/branded-types/non-negative-finite-number.test.mts +40 -0
- package/src/number/branded-types/non-negative-int16.test.mts +43 -0
- package/src/number/branded-types/non-negative-int32.test.mts +43 -0
- package/src/number/branded-types/non-zero-finite-number.test.mts +51 -0
- package/src/number/branded-types/non-zero-int.test.mts +53 -0
- package/src/number/branded-types/non-zero-int16.test.mts +44 -0
- package/src/number/branded-types/non-zero-int32.test.mts +44 -0
- package/src/number/branded-types/non-zero-safe-int.mts +2 -2
- package/src/number/branded-types/non-zero-safe-int.test.mts +62 -0
- package/src/number/branded-types/non-zero-uint16.test.mts +37 -0
- package/src/number/branded-types/non-zero-uint32.test.mts +37 -0
- package/src/number/branded-types/positive-finite-number.test.mts +45 -0
- package/src/number/branded-types/positive-int.mts +14 -0
- package/src/number/branded-types/positive-int.test.mts +47 -0
- package/src/number/branded-types/positive-int16.test.mts +35 -0
- package/src/number/branded-types/positive-int32.test.mts +35 -0
- package/src/number/branded-types/positive-safe-int.mts +22 -1
- package/src/number/branded-types/positive-safe-int.test.mts +49 -0
- package/src/number/branded-types/positive-uint16.test.mts +37 -0
- package/src/number/branded-types/positive-uint32.test.mts +37 -0
- package/src/number/branded-types/safe-int.mts +23 -2
- package/src/number/branded-types/safe-int.test.mts +52 -0
- package/src/number/branded-types/safe-uint.mts +1 -1
- package/src/number/branded-types/safe-uint.test.mts +48 -0
- package/src/number/branded-types/uint.mts +12 -0
- package/src/number/branded-types/uint.test.mts +43 -0
- package/src/number/branded-types/uint16.test.mts +41 -0
- package/src/number/branded-types/uint32.test.mts +41 -0
- package/src/number/enum/int8.test.mts +6 -0
- package/src/number/enum/uint8.test.mts +6 -0
- package/src/number/num.mts +12 -1
- package/src/number/num.test.mts +62 -0
- package/src/number/refined-number-utils.mts +25 -0
- package/src/object/object.mts +15 -0
- package/src/object/object.test.mts +10 -0
- package/src/others/cast-mutable.test.mts +7 -0
- package/src/others/cast-readonly.test.mts +17 -0
- package/src/others/if-then.test.mts +16 -0
- 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 +11 -0
- package/src/others/unknown-to-string.mts +2 -0
- package/src/others/unknown-to-string.test.mts +10 -0
- package/src/promise/promise.mts +4 -0
- package/src/promise/promise.test.mts +1 -0
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
8
|
* assert.ok(isPositiveSafeInt(1));
|
|
9
|
+
*
|
|
9
10
|
* assert.ok(isPositiveSafeInt(Number.MAX_SAFE_INTEGER));
|
|
11
|
+
*
|
|
10
12
|
* assert.notOk(isPositiveSafeInt(0));
|
|
13
|
+
*
|
|
11
14
|
* assert.ok(PositiveSafeInt.is(42));
|
|
12
15
|
* ```
|
|
13
16
|
*
|
|
@@ -24,6 +27,7 @@ export declare const isPositiveSafeInt: (a: number) => a is PositiveSafeInt;
|
|
|
24
27
|
* const branded = asPositiveSafeInt(128);
|
|
25
28
|
*
|
|
26
29
|
* assert(branded === 128);
|
|
30
|
+
*
|
|
27
31
|
* assert.ok(PositiveSafeInt.is(branded));
|
|
28
32
|
* ```
|
|
29
33
|
*
|
|
@@ -62,8 +66,11 @@ export declare const PositiveSafeInt: {
|
|
|
62
66
|
*
|
|
63
67
|
* ```ts
|
|
64
68
|
* assert.ok(isPositiveSafeInt(1));
|
|
69
|
+
*
|
|
65
70
|
* assert.ok(isPositiveSafeInt(Number.MAX_SAFE_INTEGER));
|
|
71
|
+
*
|
|
66
72
|
* assert.notOk(isPositiveSafeInt(0));
|
|
73
|
+
*
|
|
67
74
|
* assert.ok(PositiveSafeInt.is(42));
|
|
68
75
|
* ```
|
|
69
76
|
*
|
|
@@ -129,11 +136,15 @@ export declare const PositiveSafeInt: {
|
|
|
129
136
|
*
|
|
130
137
|
* ```ts
|
|
131
138
|
* const belowRange = PositiveSafeInt.clamp(0);
|
|
139
|
+
*
|
|
132
140
|
* const withinRange = PositiveSafeInt.clamp(123);
|
|
141
|
+
*
|
|
133
142
|
* const aboveRange = PositiveSafeInt.clamp(Number.MAX_SAFE_INTEGER + 10);
|
|
134
143
|
*
|
|
135
144
|
* assert(belowRange === 1);
|
|
145
|
+
*
|
|
136
146
|
* assert(withinRange === 123);
|
|
147
|
+
*
|
|
137
148
|
* assert(aboveRange === Number.MAX_SAFE_INTEGER);
|
|
138
149
|
* ```
|
|
139
150
|
*
|
|
@@ -148,10 +159,13 @@ export declare const PositiveSafeInt: {
|
|
|
148
159
|
*
|
|
149
160
|
* ```ts
|
|
150
161
|
* const min = asPositiveSafeInt(1);
|
|
162
|
+
*
|
|
151
163
|
* const max = asPositiveSafeInt(6);
|
|
164
|
+
*
|
|
152
165
|
* const randomValue = PositiveSafeInt.random(min, max);
|
|
153
166
|
*
|
|
154
167
|
* assert.ok(PositiveSafeInt.is(randomValue));
|
|
168
|
+
*
|
|
155
169
|
* assert.ok(randomValue >= 1 && randomValue <= 6);
|
|
156
170
|
* ```
|
|
157
171
|
*
|
|
@@ -165,7 +179,9 @@ export declare const PositiveSafeInt: {
|
|
|
165
179
|
*
|
|
166
180
|
* ```ts
|
|
167
181
|
* const base = asPositiveSafeInt(3);
|
|
182
|
+
*
|
|
168
183
|
* const exponent = asPositiveSafeInt(3);
|
|
184
|
+
*
|
|
169
185
|
* const power = PositiveSafeInt.pow(base, exponent);
|
|
170
186
|
*
|
|
171
187
|
* assert(power === 27);
|
|
@@ -188,6 +204,7 @@ export declare const PositiveSafeInt: {
|
|
|
188
204
|
* );
|
|
189
205
|
*
|
|
190
206
|
* assert(sum === 3048);
|
|
207
|
+
*
|
|
191
208
|
* assert.ok(PositiveSafeInt.is(sum));
|
|
192
209
|
* ```
|
|
193
210
|
*
|
|
@@ -208,6 +225,7 @@ export declare const PositiveSafeInt: {
|
|
|
208
225
|
* );
|
|
209
226
|
*
|
|
210
227
|
* assert(difference === 1);
|
|
228
|
+
*
|
|
211
229
|
* assert.ok(PositiveSafeInt.is(difference));
|
|
212
230
|
* ```
|
|
213
231
|
*
|
|
@@ -229,6 +247,7 @@ export declare const PositiveSafeInt: {
|
|
|
229
247
|
* );
|
|
230
248
|
*
|
|
231
249
|
* assert(product === 1000);
|
|
250
|
+
*
|
|
232
251
|
* assert.ok(PositiveSafeInt.is(product));
|
|
233
252
|
* ```
|
|
234
253
|
*
|
|
@@ -247,12 +266,14 @@ export declare const PositiveSafeInt: {
|
|
|
247
266
|
* asPositiveSafeInt(25),
|
|
248
267
|
* asPositiveSafeInt(4),
|
|
249
268
|
* );
|
|
269
|
+
*
|
|
250
270
|
* const clamped = PositiveSafeInt.div(
|
|
251
271
|
* asPositiveSafeInt(5),
|
|
252
272
|
* asPositiveSafeInt(50),
|
|
253
273
|
* );
|
|
254
274
|
*
|
|
255
275
|
* assert(quotient === 6);
|
|
276
|
+
*
|
|
256
277
|
* assert(clamped === 1);
|
|
257
278
|
* ```
|
|
258
279
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"names":[],"mappings":"AAiCA
|
|
1
|
+
{"version":3,"file":"positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,qCAAK,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;MAAW,CAAC;AAE1C;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -4,7 +4,7 @@ const typeNameInMessage = 'a positive safe integer';
|
|
|
4
4
|
const { MAX_VALUE, MIN_VALUE, add, castType, clamp, div, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
5
|
integerOrSafeInteger: 'SafeInteger',
|
|
6
6
|
MIN_VALUE: 1,
|
|
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-max-safe-integer
|
|
8
8
|
MAX_VALUE: Number.MAX_SAFE_INTEGER,
|
|
9
9
|
typeNameInMessage,
|
|
10
10
|
});
|
|
@@ -16,8 +16,11 @@ const { MAX_VALUE, MIN_VALUE, add, castType, clamp, div, is, max: max_, min: min
|
|
|
16
16
|
*
|
|
17
17
|
* ```ts
|
|
18
18
|
* assert.ok(isPositiveSafeInt(1));
|
|
19
|
+
*
|
|
19
20
|
* assert.ok(isPositiveSafeInt(Number.MAX_SAFE_INTEGER));
|
|
21
|
+
*
|
|
20
22
|
* assert.notOk(isPositiveSafeInt(0));
|
|
23
|
+
*
|
|
21
24
|
* assert.ok(PositiveSafeInt.is(42));
|
|
22
25
|
* ```
|
|
23
26
|
*
|
|
@@ -34,6 +37,7 @@ const isPositiveSafeInt = is;
|
|
|
34
37
|
* const branded = asPositiveSafeInt(128);
|
|
35
38
|
*
|
|
36
39
|
* assert(branded === 128);
|
|
40
|
+
*
|
|
37
41
|
* assert.ok(PositiveSafeInt.is(branded));
|
|
38
42
|
* ```
|
|
39
43
|
*
|
|
@@ -59,8 +63,11 @@ const PositiveSafeInt = {
|
|
|
59
63
|
*
|
|
60
64
|
* ```ts
|
|
61
65
|
* assert.ok(isPositiveSafeInt(1));
|
|
66
|
+
*
|
|
62
67
|
* assert.ok(isPositiveSafeInt(Number.MAX_SAFE_INTEGER));
|
|
68
|
+
*
|
|
63
69
|
* assert.notOk(isPositiveSafeInt(0));
|
|
70
|
+
*
|
|
64
71
|
* assert.ok(PositiveSafeInt.is(42));
|
|
65
72
|
* ```
|
|
66
73
|
*
|
|
@@ -126,11 +133,15 @@ const PositiveSafeInt = {
|
|
|
126
133
|
*
|
|
127
134
|
* ```ts
|
|
128
135
|
* const belowRange = PositiveSafeInt.clamp(0);
|
|
136
|
+
*
|
|
129
137
|
* const withinRange = PositiveSafeInt.clamp(123);
|
|
138
|
+
*
|
|
130
139
|
* const aboveRange = PositiveSafeInt.clamp(Number.MAX_SAFE_INTEGER + 10);
|
|
131
140
|
*
|
|
132
141
|
* assert(belowRange === 1);
|
|
142
|
+
*
|
|
133
143
|
* assert(withinRange === 123);
|
|
144
|
+
*
|
|
134
145
|
* assert(aboveRange === Number.MAX_SAFE_INTEGER);
|
|
135
146
|
* ```
|
|
136
147
|
*
|
|
@@ -145,10 +156,13 @@ const PositiveSafeInt = {
|
|
|
145
156
|
*
|
|
146
157
|
* ```ts
|
|
147
158
|
* const min = asPositiveSafeInt(1);
|
|
159
|
+
*
|
|
148
160
|
* const max = asPositiveSafeInt(6);
|
|
161
|
+
*
|
|
149
162
|
* const randomValue = PositiveSafeInt.random(min, max);
|
|
150
163
|
*
|
|
151
164
|
* assert.ok(PositiveSafeInt.is(randomValue));
|
|
165
|
+
*
|
|
152
166
|
* assert.ok(randomValue >= 1 && randomValue <= 6);
|
|
153
167
|
* ```
|
|
154
168
|
*
|
|
@@ -162,7 +176,9 @@ const PositiveSafeInt = {
|
|
|
162
176
|
*
|
|
163
177
|
* ```ts
|
|
164
178
|
* const base = asPositiveSafeInt(3);
|
|
179
|
+
*
|
|
165
180
|
* const exponent = asPositiveSafeInt(3);
|
|
181
|
+
*
|
|
166
182
|
* const power = PositiveSafeInt.pow(base, exponent);
|
|
167
183
|
*
|
|
168
184
|
* assert(power === 27);
|
|
@@ -185,6 +201,7 @@ const PositiveSafeInt = {
|
|
|
185
201
|
* );
|
|
186
202
|
*
|
|
187
203
|
* assert(sum === 3048);
|
|
204
|
+
*
|
|
188
205
|
* assert.ok(PositiveSafeInt.is(sum));
|
|
189
206
|
* ```
|
|
190
207
|
*
|
|
@@ -205,6 +222,7 @@ const PositiveSafeInt = {
|
|
|
205
222
|
* );
|
|
206
223
|
*
|
|
207
224
|
* assert(difference === 1);
|
|
225
|
+
*
|
|
208
226
|
* assert.ok(PositiveSafeInt.is(difference));
|
|
209
227
|
* ```
|
|
210
228
|
*
|
|
@@ -226,6 +244,7 @@ const PositiveSafeInt = {
|
|
|
226
244
|
* );
|
|
227
245
|
*
|
|
228
246
|
* assert(product === 1000);
|
|
247
|
+
*
|
|
229
248
|
* assert.ok(PositiveSafeInt.is(product));
|
|
230
249
|
* ```
|
|
231
250
|
*
|
|
@@ -244,12 +263,14 @@ const PositiveSafeInt = {
|
|
|
244
263
|
* asPositiveSafeInt(25),
|
|
245
264
|
* asPositiveSafeInt(4),
|
|
246
265
|
* );
|
|
266
|
+
*
|
|
247
267
|
* const clamped = PositiveSafeInt.div(
|
|
248
268
|
* asPositiveSafeInt(5),
|
|
249
269
|
* asPositiveSafeInt(50),
|
|
250
270
|
* );
|
|
251
271
|
*
|
|
252
272
|
* assert(quotient === 6);
|
|
273
|
+
*
|
|
253
274
|
* assert(clamped === 1);
|
|
254
275
|
* ```
|
|
255
276
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-safe-int.mjs","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,yBAAyB;AAEnD,MAAM,EACJ,SAAS,EACT,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,aAAa;AACnC,IAAA,SAAS,EAAE,CAAC;;IAEZ,SAAS,EAAE,MAAM,CAAC,gBAA4B;IAC9C,iBAAiB;AACT,CAAA,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"positive-safe-int.mjs","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,yBAAyB;AAEnD,MAAM,EACJ,SAAS,EACT,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,aAAa;AACnC,IAAA,SAAS,EAAE,CAAC;;IAEZ,SAAS,EAAE,MAAM,CAAC,gBAA4B;IAC9C,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,iBAAiB,GAAG;AAEjC;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,iBAAiB,GAAG;AAEjC;;;;;;;;AAQG;AACI,MAAM,eAAe,GAAG;AAC7B;;;;;;;;;;;;;;;;;;AAkBG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;AAIG;IACH,SAAS;AAET;;;;;;;;;;;;;;;;;AAiBG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;AAiBG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;;;;;AAqBG;IACH,KAAK;AAEL;;;;;;;;;;;;;;;;;;AAkBG;IACH,MAAM;AAEN;;;;;;;;;;;;;;;;;;AAkBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;;;AAmBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;;;;AAoBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;;;AAmBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;IACH,GAAG;;;;;"}
|
|
@@ -9,7 +9,9 @@ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
|
9
9
|
*
|
|
10
10
|
* ```ts
|
|
11
11
|
* assert.ok(isSafeInt(Number.MAX_SAFE_INTEGER));
|
|
12
|
+
*
|
|
12
13
|
* assert.notOk(isSafeInt(Number.MAX_SAFE_INTEGER + 0.5));
|
|
14
|
+
*
|
|
13
15
|
* assert.ok(SafeInt.is(Number.MIN_SAFE_INTEGER));
|
|
14
16
|
* ```
|
|
15
17
|
*
|
|
@@ -30,6 +32,7 @@ export declare const isSafeInt: (a: number) => a is SafeInt;
|
|
|
30
32
|
* const branded = asSafeInt(123);
|
|
31
33
|
*
|
|
32
34
|
* assert(branded === 123);
|
|
35
|
+
*
|
|
33
36
|
* assert.ok(SafeInt.is(branded));
|
|
34
37
|
* ```
|
|
35
38
|
*
|
|
@@ -69,7 +72,9 @@ export declare const SafeInt: {
|
|
|
69
72
|
*
|
|
70
73
|
* ```ts
|
|
71
74
|
* assert.ok(isSafeInt(Number.MAX_SAFE_INTEGER));
|
|
75
|
+
*
|
|
72
76
|
* assert.notOk(isSafeInt(Number.MAX_SAFE_INTEGER + 0.5));
|
|
77
|
+
*
|
|
73
78
|
* assert.ok(SafeInt.is(Number.MIN_SAFE_INTEGER));
|
|
74
79
|
* ```
|
|
75
80
|
*
|
|
@@ -100,9 +105,11 @@ export declare const SafeInt: {
|
|
|
100
105
|
*
|
|
101
106
|
* ```ts
|
|
102
107
|
* const negative = asSafeInt(-900);
|
|
108
|
+
*
|
|
103
109
|
* const absolute = SafeInt.abs(negative);
|
|
104
110
|
*
|
|
105
111
|
* assert(absolute === 900);
|
|
112
|
+
*
|
|
106
113
|
* assert.ok(SafeInt.is(absolute));
|
|
107
114
|
* ```
|
|
108
115
|
*
|
|
@@ -147,11 +154,15 @@ export declare const SafeInt: {
|
|
|
147
154
|
*
|
|
148
155
|
* ```ts
|
|
149
156
|
* const aboveRange = SafeInt.clamp(1e20);
|
|
157
|
+
*
|
|
150
158
|
* const withinRange = SafeInt.clamp(123);
|
|
159
|
+
*
|
|
151
160
|
* const belowRange = SafeInt.clamp(-1e20);
|
|
152
161
|
*
|
|
153
162
|
* assert(aboveRange === Number.MAX_SAFE_INTEGER);
|
|
163
|
+
*
|
|
154
164
|
* assert(withinRange === 123);
|
|
165
|
+
*
|
|
155
166
|
* assert(belowRange === Number.MIN_SAFE_INTEGER);
|
|
156
167
|
* ```
|
|
157
168
|
*
|
|
@@ -170,10 +181,13 @@ export declare const SafeInt: {
|
|
|
170
181
|
*
|
|
171
182
|
* ```ts
|
|
172
183
|
* const min = asSafeInt(-10);
|
|
184
|
+
*
|
|
173
185
|
* const max = asSafeInt(10);
|
|
186
|
+
*
|
|
174
187
|
* const randomValue = SafeInt.random(min, max);
|
|
175
188
|
*
|
|
176
189
|
* assert.ok(SafeInt.is(randomValue));
|
|
190
|
+
*
|
|
177
191
|
* assert.ok(randomValue >= -10 && randomValue <= 10);
|
|
178
192
|
* ```
|
|
179
193
|
*
|
|
@@ -189,10 +203,13 @@ export declare const SafeInt: {
|
|
|
189
203
|
*
|
|
190
204
|
* ```ts
|
|
191
205
|
* const base = asSafeInt(3);
|
|
206
|
+
*
|
|
192
207
|
* const exponent = asSafeInt(5);
|
|
208
|
+
*
|
|
193
209
|
* const power = SafeInt.pow(base, exponent);
|
|
194
210
|
*
|
|
195
211
|
* assert(power === 243);
|
|
212
|
+
*
|
|
196
213
|
* assert.ok(SafeInt.is(power));
|
|
197
214
|
* ```
|
|
198
215
|
*
|
|
@@ -210,6 +227,7 @@ export declare const SafeInt: {
|
|
|
210
227
|
* const sum = SafeInt.add(asSafeInt(9), asSafeInt(4));
|
|
211
228
|
*
|
|
212
229
|
* assert(sum === 13);
|
|
230
|
+
*
|
|
213
231
|
* assert.ok(SafeInt.is(sum));
|
|
214
232
|
* ```
|
|
215
233
|
*
|
|
@@ -227,6 +245,7 @@ export declare const SafeInt: {
|
|
|
227
245
|
* const difference = SafeInt.sub(asSafeInt(9), asSafeInt(14));
|
|
228
246
|
*
|
|
229
247
|
* assert(difference === -5);
|
|
248
|
+
*
|
|
230
249
|
* assert.ok(SafeInt.is(difference));
|
|
231
250
|
* ```
|
|
232
251
|
*
|
|
@@ -244,6 +263,7 @@ export declare const SafeInt: {
|
|
|
244
263
|
* const product = SafeInt.mul(asSafeInt(-8), asSafeInt(7));
|
|
245
264
|
*
|
|
246
265
|
* assert(product === -56);
|
|
266
|
+
*
|
|
247
267
|
* assert.ok(SafeInt.is(product));
|
|
248
268
|
* ```
|
|
249
269
|
*
|
|
@@ -264,6 +284,7 @@ export declare const SafeInt: {
|
|
|
264
284
|
* const quotient = SafeInt.div(asSafeInt(-17), asSafeInt(5));
|
|
265
285
|
*
|
|
266
286
|
* assert(quotient === -4);
|
|
287
|
+
*
|
|
267
288
|
* assert.ok(SafeInt.is(quotient));
|
|
268
289
|
* ```
|
|
269
290
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/safe-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAkCnE
|
|
1
|
+
{"version":3,"file":"safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/safe-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAkCnE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS,6BAAK,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS;;;;;;;MAAW,CAAC;AAElC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,OAAO;IAClB;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -3,9 +3,9 @@ import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
|
3
3
|
const typeNameInMessage = 'a safe integer';
|
|
4
4
|
const { MAX_VALUE, MIN_VALUE, abs, add, castType, clamp, div, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
5
|
integerOrSafeInteger: 'SafeInteger',
|
|
6
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
6
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion, math/prefer-number-min-safe-integer
|
|
7
7
|
MIN_VALUE: Number.MIN_SAFE_INTEGER,
|
|
8
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
8
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion, math/prefer-number-max-safe-integer
|
|
9
9
|
MAX_VALUE: Number.MAX_SAFE_INTEGER,
|
|
10
10
|
typeNameInMessage,
|
|
11
11
|
});
|
|
@@ -19,7 +19,9 @@ const { MAX_VALUE, MIN_VALUE, abs, add, castType, clamp, div, is, max: max_, min
|
|
|
19
19
|
*
|
|
20
20
|
* ```ts
|
|
21
21
|
* assert.ok(isSafeInt(Number.MAX_SAFE_INTEGER));
|
|
22
|
+
*
|
|
22
23
|
* assert.notOk(isSafeInt(Number.MAX_SAFE_INTEGER + 0.5));
|
|
24
|
+
*
|
|
23
25
|
* assert.ok(SafeInt.is(Number.MIN_SAFE_INTEGER));
|
|
24
26
|
* ```
|
|
25
27
|
*
|
|
@@ -40,6 +42,7 @@ const isSafeInt = is;
|
|
|
40
42
|
* const branded = asSafeInt(123);
|
|
41
43
|
*
|
|
42
44
|
* assert(branded === 123);
|
|
45
|
+
*
|
|
43
46
|
* assert.ok(SafeInt.is(branded));
|
|
44
47
|
* ```
|
|
45
48
|
*
|
|
@@ -72,7 +75,9 @@ const SafeInt = {
|
|
|
72
75
|
*
|
|
73
76
|
* ```ts
|
|
74
77
|
* assert.ok(isSafeInt(Number.MAX_SAFE_INTEGER));
|
|
78
|
+
*
|
|
75
79
|
* assert.notOk(isSafeInt(Number.MAX_SAFE_INTEGER + 0.5));
|
|
80
|
+
*
|
|
76
81
|
* assert.ok(SafeInt.is(Number.MIN_SAFE_INTEGER));
|
|
77
82
|
* ```
|
|
78
83
|
*
|
|
@@ -103,9 +108,11 @@ const SafeInt = {
|
|
|
103
108
|
*
|
|
104
109
|
* ```ts
|
|
105
110
|
* const negative = asSafeInt(-900);
|
|
111
|
+
*
|
|
106
112
|
* const absolute = SafeInt.abs(negative);
|
|
107
113
|
*
|
|
108
114
|
* assert(absolute === 900);
|
|
115
|
+
*
|
|
109
116
|
* assert.ok(SafeInt.is(absolute));
|
|
110
117
|
* ```
|
|
111
118
|
*
|
|
@@ -150,11 +157,15 @@ const SafeInt = {
|
|
|
150
157
|
*
|
|
151
158
|
* ```ts
|
|
152
159
|
* const aboveRange = SafeInt.clamp(1e20);
|
|
160
|
+
*
|
|
153
161
|
* const withinRange = SafeInt.clamp(123);
|
|
162
|
+
*
|
|
154
163
|
* const belowRange = SafeInt.clamp(-1e20);
|
|
155
164
|
*
|
|
156
165
|
* assert(aboveRange === Number.MAX_SAFE_INTEGER);
|
|
166
|
+
*
|
|
157
167
|
* assert(withinRange === 123);
|
|
168
|
+
*
|
|
158
169
|
* assert(belowRange === Number.MIN_SAFE_INTEGER);
|
|
159
170
|
* ```
|
|
160
171
|
*
|
|
@@ -173,10 +184,13 @@ const SafeInt = {
|
|
|
173
184
|
*
|
|
174
185
|
* ```ts
|
|
175
186
|
* const min = asSafeInt(-10);
|
|
187
|
+
*
|
|
176
188
|
* const max = asSafeInt(10);
|
|
189
|
+
*
|
|
177
190
|
* const randomValue = SafeInt.random(min, max);
|
|
178
191
|
*
|
|
179
192
|
* assert.ok(SafeInt.is(randomValue));
|
|
193
|
+
*
|
|
180
194
|
* assert.ok(randomValue >= -10 && randomValue <= 10);
|
|
181
195
|
* ```
|
|
182
196
|
*
|
|
@@ -192,10 +206,13 @@ const SafeInt = {
|
|
|
192
206
|
*
|
|
193
207
|
* ```ts
|
|
194
208
|
* const base = asSafeInt(3);
|
|
209
|
+
*
|
|
195
210
|
* const exponent = asSafeInt(5);
|
|
211
|
+
*
|
|
196
212
|
* const power = SafeInt.pow(base, exponent);
|
|
197
213
|
*
|
|
198
214
|
* assert(power === 243);
|
|
215
|
+
*
|
|
199
216
|
* assert.ok(SafeInt.is(power));
|
|
200
217
|
* ```
|
|
201
218
|
*
|
|
@@ -213,6 +230,7 @@ const SafeInt = {
|
|
|
213
230
|
* const sum = SafeInt.add(asSafeInt(9), asSafeInt(4));
|
|
214
231
|
*
|
|
215
232
|
* assert(sum === 13);
|
|
233
|
+
*
|
|
216
234
|
* assert.ok(SafeInt.is(sum));
|
|
217
235
|
* ```
|
|
218
236
|
*
|
|
@@ -230,6 +248,7 @@ const SafeInt = {
|
|
|
230
248
|
* const difference = SafeInt.sub(asSafeInt(9), asSafeInt(14));
|
|
231
249
|
*
|
|
232
250
|
* assert(difference === -5);
|
|
251
|
+
*
|
|
233
252
|
* assert.ok(SafeInt.is(difference));
|
|
234
253
|
* ```
|
|
235
254
|
*
|
|
@@ -247,6 +266,7 @@ const SafeInt = {
|
|
|
247
266
|
* const product = SafeInt.mul(asSafeInt(-8), asSafeInt(7));
|
|
248
267
|
*
|
|
249
268
|
* assert(product === -56);
|
|
269
|
+
*
|
|
250
270
|
* assert.ok(SafeInt.is(product));
|
|
251
271
|
* ```
|
|
252
272
|
*
|
|
@@ -267,6 +287,7 @@ const SafeInt = {
|
|
|
267
287
|
* const quotient = SafeInt.div(asSafeInt(-17), asSafeInt(5));
|
|
268
288
|
*
|
|
269
289
|
* assert(quotient === -4);
|
|
290
|
+
*
|
|
270
291
|
* assert.ok(SafeInt.is(quotient));
|
|
271
292
|
* ```
|
|
272
293
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-int.mjs","sources":["../../../src/number/branded-types/safe-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,gBAAgB;AAE1C,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,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,aAAa;;IAEnC,SAAS,EAAE,MAAM,CAAC,gBAA2B;;IAE7C,SAAS,EAAE,MAAM,CAAC,gBAA4B;IAC9C,iBAAiB;AACT,CAAA,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"safe-int.mjs","sources":["../../../src/number/branded-types/safe-int.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,gBAAgB;AAE1C,MAAM,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,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,aAAa;;IAEnC,SAAS,EAAE,MAAM,CAAC,gBAA2B;;IAE7C,SAAS,EAAE,MAAM,CAAC,gBAA4B;IAC9C,iBAAiB;AACT,CAAA,CAAC;AAEX;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,SAAS,GAAG;AAEzB;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,SAAS,GAAG;AAEzB;;;;;;;;;;;;;;;AAeG;AACI,MAAM,OAAO,GAAG;AACrB;;;;;;;;;;;;;;;;AAgBG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;AAIG;IACH,SAAS;AAET;;;;;;;;;;;;;;;;;;;;AAoBG;IACH,GAAG;AAEH;;;;;;;;;;;;;AAaG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;AAaG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;;;;;;AAsBG;IACH,KAAK;AAEL;;;;;;;;;;;;;;;;;;;;;;;AAuBG;IACH,MAAM;AAEN;;;;;;;;;;;;;;;;;;;;AAoBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;AAgBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;AAgBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;AAgBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;;;;;;AAmBG;IACH,GAAG;;;;;"}
|
|
@@ -4,7 +4,7 @@ const typeNameInMessage = 'a non-negative safe integer';
|
|
|
4
4
|
const { MAX_VALUE, MIN_VALUE, add, castType, clamp, div, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
5
|
integerOrSafeInteger: 'SafeInteger',
|
|
6
6
|
MIN_VALUE: 0,
|
|
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-max-safe-integer
|
|
8
8
|
MAX_VALUE: Number.MAX_SAFE_INTEGER,
|
|
9
9
|
typeNameInMessage,
|
|
10
10
|
});
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* ```ts
|
|
7
7
|
* assert.ok(isUint(4));
|
|
8
|
+
*
|
|
8
9
|
* assert.notOk(isUint(-1));
|
|
10
|
+
*
|
|
9
11
|
* assert.ok(Uint.is(0));
|
|
10
12
|
* ```
|
|
11
13
|
*
|
|
@@ -22,6 +24,7 @@ export declare const isUint: (a: number) => a is NonNegativeInt;
|
|
|
22
24
|
* const branded = asUint(12);
|
|
23
25
|
*
|
|
24
26
|
* assert(branded === 12);
|
|
27
|
+
*
|
|
25
28
|
* assert.ok(Uint.is(branded));
|
|
26
29
|
* ```
|
|
27
30
|
*
|
|
@@ -56,7 +59,9 @@ export declare const Uint: {
|
|
|
56
59
|
*
|
|
57
60
|
* ```ts
|
|
58
61
|
* assert.ok(isUint(4));
|
|
62
|
+
*
|
|
59
63
|
* assert.notOk(isUint(-1));
|
|
64
|
+
*
|
|
60
65
|
* assert.ok(Uint.is(0));
|
|
61
66
|
* ```
|
|
62
67
|
*
|
|
@@ -110,9 +115,11 @@ export declare const Uint: {
|
|
|
110
115
|
*
|
|
111
116
|
* ```ts
|
|
112
117
|
* const clampedNegative = Uint.clamp(-5);
|
|
118
|
+
*
|
|
113
119
|
* const clampedPositive = Uint.clamp(42);
|
|
114
120
|
*
|
|
115
121
|
* assert(clampedNegative === 0);
|
|
122
|
+
*
|
|
116
123
|
* assert(clampedPositive === 42);
|
|
117
124
|
* ```
|
|
118
125
|
*
|
|
@@ -127,10 +134,13 @@ export declare const Uint: {
|
|
|
127
134
|
*
|
|
128
135
|
* ```ts
|
|
129
136
|
* const min = asUint(0);
|
|
137
|
+
*
|
|
130
138
|
* const max = asUint(3);
|
|
139
|
+
*
|
|
131
140
|
* const randomValue = Uint.random(min, max);
|
|
132
141
|
*
|
|
133
142
|
* assert.ok(Uint.is(randomValue));
|
|
143
|
+
*
|
|
134
144
|
* assert.ok(randomValue >= 0 && randomValue <= 3);
|
|
135
145
|
* ```
|
|
136
146
|
*
|
|
@@ -144,7 +154,9 @@ export declare const Uint: {
|
|
|
144
154
|
*
|
|
145
155
|
* ```ts
|
|
146
156
|
* const base = asUint(2);
|
|
157
|
+
*
|
|
147
158
|
* const exponent = asUint(5);
|
|
159
|
+
*
|
|
148
160
|
* const power = Uint.pow(base, exponent);
|
|
149
161
|
*
|
|
150
162
|
* assert(power === 32);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint.mts"],"names":[],"mappings":"AA+BA
|
|
1
|
+
{"version":3,"file":"uint.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint.mts"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,oCAAK,CAAC;AAEzB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;MAAW,CAAC;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;IACf;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;OAIG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -14,7 +14,9 @@ const { MIN_VALUE, add, castType, clamp, div, is, max: max_, min: min_, mul, pow
|
|
|
14
14
|
*
|
|
15
15
|
* ```ts
|
|
16
16
|
* assert.ok(isUint(4));
|
|
17
|
+
*
|
|
17
18
|
* assert.notOk(isUint(-1));
|
|
19
|
+
*
|
|
18
20
|
* assert.ok(Uint.is(0));
|
|
19
21
|
* ```
|
|
20
22
|
*
|
|
@@ -31,6 +33,7 @@ const isUint = is;
|
|
|
31
33
|
* const branded = asUint(12);
|
|
32
34
|
*
|
|
33
35
|
* assert(branded === 12);
|
|
36
|
+
*
|
|
34
37
|
* assert.ok(Uint.is(branded));
|
|
35
38
|
* ```
|
|
36
39
|
*
|
|
@@ -54,7 +57,9 @@ const Uint = {
|
|
|
54
57
|
*
|
|
55
58
|
* ```ts
|
|
56
59
|
* assert.ok(isUint(4));
|
|
60
|
+
*
|
|
57
61
|
* assert.notOk(isUint(-1));
|
|
62
|
+
*
|
|
58
63
|
* assert.ok(Uint.is(0));
|
|
59
64
|
* ```
|
|
60
65
|
*
|
|
@@ -108,9 +113,11 @@ const Uint = {
|
|
|
108
113
|
*
|
|
109
114
|
* ```ts
|
|
110
115
|
* const clampedNegative = Uint.clamp(-5);
|
|
116
|
+
*
|
|
111
117
|
* const clampedPositive = Uint.clamp(42);
|
|
112
118
|
*
|
|
113
119
|
* assert(clampedNegative === 0);
|
|
120
|
+
*
|
|
114
121
|
* assert(clampedPositive === 42);
|
|
115
122
|
* ```
|
|
116
123
|
*
|
|
@@ -125,10 +132,13 @@ const Uint = {
|
|
|
125
132
|
*
|
|
126
133
|
* ```ts
|
|
127
134
|
* const min = asUint(0);
|
|
135
|
+
*
|
|
128
136
|
* const max = asUint(3);
|
|
137
|
+
*
|
|
129
138
|
* const randomValue = Uint.random(min, max);
|
|
130
139
|
*
|
|
131
140
|
* assert.ok(Uint.is(randomValue));
|
|
141
|
+
*
|
|
132
142
|
* assert.ok(randomValue >= 0 && randomValue <= 3);
|
|
133
143
|
* ```
|
|
134
144
|
*
|
|
@@ -142,7 +152,9 @@ const Uint = {
|
|
|
142
152
|
*
|
|
143
153
|
* ```ts
|
|
144
154
|
* const base = asUint(2);
|
|
155
|
+
*
|
|
145
156
|
* const exponent = asUint(5);
|
|
157
|
+
*
|
|
146
158
|
* const power = Uint.pow(base, exponent);
|
|
147
159
|
*
|
|
148
160
|
* assert(power === 32);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint.mjs","sources":["../../../src/number/branded-types/uint.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,wBAAwB;AAElD,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":"uint.mjs","sources":["../../../src/number/branded-types/uint.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA,MAAM,iBAAiB,GAAG,wBAAwB;AAElD,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;;;;;;;;;;;;;;;AAeG;AACI,MAAM,MAAM,GAAG;AAEtB;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,MAAM,GAAG;AAEtB;;;;;;AAMG;AACI,MAAM,IAAI,GAAG;AAClB;;;;;;;;;;;;;;;;AAgBG;IACH,EAAE;AAEF;;;;AAIG;IACH,SAAS;AAET;;;;;;;;;;;;;;AAcG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;AAcG;AACH,IAAA,GAAG,EAAE,IAAI;AAET;;;;;;;;;;;;;;;;;AAiBG;IACH,KAAK;AAEL;;;;;;;;;;;;;;;;;;AAkBG;IACH,MAAM;AAEN;;;;;;;;;;;;;;;;;;AAkBG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;AAEH;;;;;;;;;;;;;;AAcG;IACH,GAAG;;;;;"}
|