feat: factories can depend on the presence of types
All checks were successful
/ test (pull_request) Successful in 17s
All checks were successful
/ test (pull_request) Successful in 17s
Refactors each TypeDispatcher to have its own separate collection of types. Add isnan function which returns a boolean if that type is present, otherwise returns the number 1 for true, and 0 for fase.
This commit is contained in:
parent
a7673216c1
commit
b2b41d6348
8 changed files with 43 additions and 16 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import {plain} from './helpers.js'
|
||||
import {plain, boolnum} from './helpers.js'
|
||||
import {BooleanT} from '#boolean/BooleanT.js'
|
||||
import {Returns} from '#core/Type.js'
|
||||
import {NumberT} from '#number/NumberT.js'
|
||||
|
|
@ -7,6 +7,6 @@ const num = f => Returns(NumberT, f)
|
|||
|
||||
export const number = plain(a => a)
|
||||
number.also(
|
||||
BooleanT, num(a => a ? 1 : 0),
|
||||
BooleanT, boolnum,
|
||||
[], num(() => 0)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue