I think there is a way to do that with lodash, as this suggests...
_.startCase('helloThere');
If you want roll something yourself you can do something like this however my invention can't really account for characters that are not letters. If you want to account for characters that are not letters you would have to check to see if .toUpperCase() and .toLowerCase() off of a character matched up I suppose. My stuff also does not play nice with one letter words like I or A. Anyhow, this will turn this:
export enum Role {
Administrator,
ComplianceGroup,
BusinessUnitSME,
BUAggregator,
ReadOnlyAuditor
}
...into this:
- Administrator
- Compliance Group
- Business Unit SME
- BU Aggregator
- Read Only Auditor
No comments:
Post a Comment