/** * An if-else branch using function composition. * @param condition - a constant boolean value or a function that resolves to a boolean * @param pass - a function to execute if the condition passes * @param fail - a function to execute if the condition fails * @returns the result of calling pass if the condition is true, or the result of calling fail if not * ```typescript * pipe( * 5, * ifElse( * num => num > 3, * num => num / 2, // -> 2.5 * num => num * 2 * ) * ); * * pipe( * 2, * ifElse( * num => num > 3, * num => num / 2, * num => num * 2 // -> 4 * ) * ); * ``` */ export declare function ifElse(condition: ((value: V) => boolean) | boolean, pass: (value: V) => R1, fail: (value: V) => R2): (value: V) => R1 | R2; /** * An if-then branch using function composition * @param condition - a constant boolean value or a function that resolves to a boolean * @param pass - a function to execute if the condition passes * @returns the result of calling pass if the condition is true, or the initial value if not * ```typescript * pipe( * 5, * ifThen( * num => num > 3, * num => num / 2 // -> 2.5 * ) * ); * * pipe( * 2, * ifThen( * num => num > 3, * num => num / 2 * ) // -> 2 * ); * `` */ export declare function ifThen(condition: ((value: V) => boolean) | boolean, pass: (value: V) => R): (value: V) => R | V; /** * A switch-case expression using function composition. * @param conditions - an array of pairs matching a boolean value or a function returning a boolean, to a function to execute if true * @returns the result of the function matching the first true condition * ```typescript * switchCase([ * [ () => false, () => 4 ], * [ () => true, () => 3], // -> 3 * [ true, () => 2 ] * ]); * ``` */ export declare function switchCase(conditions: [(() => boolean) | boolean, () => R][]): R | undefined;