Files
agent/src/util/index.ts
2016-11-23 22:44:43 +01:00

11 lines
431 B
TypeScript

// Source: http://stackoverflow.com/questions/13720256/javascript-regex-camelcase-to-sentence
export function camelCaseToSentence(camelCasedText: string): string {
return camelCasedText.replace(/^[a-z]|[A-Z]/g, function (v, i) {
return i === 0 ? v.toUpperCase() : ' ' + v.toLowerCase();
});
}
export function capitalizeFirstLetter(text: string): string {
return text.charAt(0).toUpperCase() + text.slice(1);
}