nanomath/src/boolean/type.js
Glen Whitney a7673216c1
All checks were successful
/ test (pull_request) Successful in 18s
chore: add boolean test files omitted earlier
2025-04-13 00:14:56 -07:00

14 lines
411 B
JavaScript

import {BooleanT} from './BooleanT.js'
import {onType} from '#core/helpers.js'
import {Returns, Type, TypeOfTypes, Undefined} from '#core/Type.js'
import {NumberT} from '#number/NumberT.js'
const bool = f => Returns(BooleanT, f)
export const boolean = onType(
BooleanT, bool(p => p),
NumberT, bool(a => !!a),
TypeOfTypes, bool(() => true),
Undefined, bool(() => false),
[], bool(() => false)
)