B (Boolean)
not_(a: boolean): booleanand_(a: boolean, b: boolean): boolean // dualor_(a: boolean, b: boolean): boolean // dualifElse<A>(cond: boolean, onTrue: () => A, onFalse: () => A): A // dualTrailing underscores avoid colliding with JS reserved words.
Examples
Section titled “Examples”import { pipe, B } from '@stopcock/fp'
pipe(true, B.not_) // falsepipe(true, B.and_(false)) // falsepipe(false, B.ifElse(() => 'yes', () => 'no')) // 'no'
// toggle a feature flagconst toggled = pipe(isEnabled, B.not_)
// both conditions must holdconst canAccess = pipe(isAdmin, B.and_(isActive))