feat: add conversions to boolean and make mandatory
Some checks failed
/ test (pull_request) Failing after 16s
Some checks failed
/ test (pull_request) Failing after 16s
This commit is contained in:
parent
f38a2d5e88
commit
4b81fbe6e2
3 changed files with 9 additions and 1 deletions
|
|
@ -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)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue