@ou-imdt/utils
Version:
Utility library for interactive media development
10 lines • 414 B
JavaScript
/**
* Performs a ternary-like operation.
* @param {boolean} condition - The condition to evaluate.
* @param {*} trueResult - Value to return if the condition is true.
* @param {*} falseResult - Value to return if the condition is false.
* @returns {*} The result based on the condition.
*/
export default function ternary(condition, trueResult, falseResult) {
return condition ? trueResult : falseResult;
}