2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2022-12-20 16:02:44 +00:00
|
|
|
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);
|