B (Boolean)
not_(a: boolean): booleanand_(b: boolean): (a: boolean) => booleanor_(b: boolean): (a: boolean) => booleanifElse<A>(onTrue: () => A, onFalse: () => A): (cond: boolean) => ATrailing underscores avoid colliding with JS reserved words.
Examples
Section titled “Examples”import { pipe } from '@stopcock/fp'import * as B from '@stopcock/fp/boolean'
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))