Better quote prefix generator

This commit is contained in:
Bryan Ashby 2017-08-24 22:20:07 -06:00
parent dc39998841
commit fc200250e8
1 changed files with 12 additions and 2 deletions

View File

@ -165,8 +165,18 @@ function getUTCTimeZoneOffset() {
// Get a FSC-0032 style quote prefixes
function getQuotePrefix(name) {
// :TODO: Add support for real names (e.g. with spaces) -> initials
return ' ' + name[0].toUpperCase() + name[1].toLowerCase() + '> ';
let initials;
const parts = name.split(' ');
if(parts.length > 1) {
// First & Last initials - (Bryan Ashby -> BA)
initials = `${parts[0].slice(0, 1)}${parts[parts.length - 1].slice(0, 1)}`.toUpperCase();
} else {
// Just use the first two - (NuSkooler -> Nu)
initials = _.capitalize(name.slice(0, 2));
}
return ` ${initials}> `;
}
//