feat: add conversions to boolean and make mandatory
Some checks failed
/ test (pull_request) Failing after 16s

This commit is contained in:
Glen Whitney 2025-04-12 07:46:15 -07:00
parent f38a2d5e88
commit 4b81fbe6e2
3 changed files with 9 additions and 1 deletions

View file

@ -3,5 +3,10 @@ import {BooleanT} from '#boolean/BooleanT.js'
import {Returns} from '#core/Type.js'
import {NumberT} from '#number/NumberT.js'
const num = f => Returns(NumberT, f)
export const number = plain(a => a)
number.also(BooleanT, Returns(NumberT, a => a ? 1 : 0))
number.also(
BooleanT, num(a => a ? 1 : 0),
[], num(() => 0)
)