open-nomad/ui/app/helpers/conditionally-capitalize.js
Phil Renaud 281f6a6fba
[ui] Make the not-auth'd messages in the app less token-centric (#15557)
* Make the not-auth'd messages in the app less token-centric

* new helper to conditionally capitalize handlebars strings
2022-12-20 11:02:44 -05:00

14 lines
393 B
JavaScript

import Helper from '@ember/component/helper';
/**
* If the condition is true, capitalize the first letter of the term.
* Otherwise, return the term in lowercase.
*/
export function conditionallyCapitalize([term, condition]) {
return condition
? `${term.charAt(0).toUpperCase()}${term.substring(1)}`
: term.toLowerCase();
}
export default Helper.helper(conditionallyCapitalize);