B (Boolean)
All three dual Boolean operations appear with both shapes in the complete dual-call catalogue.
not_(a: boolean): booleanand_(a: boolean, b: boolean): booleanand_(b: boolean): (a: boolean) => booleanor_(a: boolean, b: boolean): booleanor_(b: boolean): (a: boolean) => booleanifElse<A>(cond: boolean, onTrue: () => A, onFalse: () => A): AifElse<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_) // falseB.and_(true, false) // false, direct data-firstpipe(true, B.and_(false)) // false, curried data-lastpipe( 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))