Checks an input for truthiness then calls the respective callback, returning the callback's output.
The called callback's output.
import {ifTruthy} from '@augment-vir/common';const result1 = ifTruthy( true, () => 1, () => 2,); // result1 is `1`const result2 = ifTruthy( false, () => 1, () => 2,); // result2 is `2` Copy
import {ifTruthy} from '@augment-vir/common';const result1 = ifTruthy( true, () => 1, () => 2,); // result1 is `1`const result2 = ifTruthy( false, () => 1, () => 2,); // result2 is `2`
@augment-vir/common
Checks an input for truthiness then calls the respective callback, returning the callback's output.