Ghost/ghost/admin/app/helpers/humanize-setting-key.js
Kevin Ansfield 8d12c9ba59 Added RSS capitalisation in custom theme setting labels
no issue

- ensures capitalisation of custom theme setting labels matches expectations
2021-11-05 09:12:14 +00:00

18 lines
473 B
JavaScript

import {helper} from '@ember/component/helper';
import {humanize} from 'ember-cli-string-helpers/helpers/humanize';
export function humanizeSettingKey([key]) {
let humanized = humanize([key]);
const allCaps = ['API', 'CTA', 'RSS'];
allCaps.forEach((str) => {
const regex = new RegExp(`(^| )(${str})( |$)`, 'gi');
humanized = humanized.replace(regex, `$1${str}$3`);
});
return humanized;
}
export default helper(humanizeSettingKey);