open-consul/ui-v2/app/helpers/default.js
John Cowen ab568f6b94
ui: Adds a default view helper for providing a default value (#4650)
If the first value passed to the helper is an empty string or undefined
then return the second value
2018-09-12 20:38:57 +01:00

11 lines
236 B
JavaScript

import { helper } from '@ember/component/helper';
export function _default(params, hash) {
if (params[0] === '' || typeof params[0] === 'undefined') {
return params[1];
}
return params[0];
}
export default helper(_default);