open-nomad/ui/app/helpers/conditionally-capitalize.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
471 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
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);