discourse/app/assets/javascripts/truth-helpers/addon/helpers/or.js

14 lines
333 B
JavaScript

import Helper from "@ember/component/helper";
import truthConvert from "../utils/truth-convert";
export function or(params) {
for (let i = 0, len = params.length; i < len; i++) {
if (truthConvert(params[i]) === true) {
return params[i];
}
}
return params[params.length - 1];
}
export default Helper.helper(or);