mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
19 lines
472 B
JavaScript
19 lines
472 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
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);
|