@ -24,7 +24,9 @@
< div class = "flex columns-3" >
< h2 class = "text-md font-bold w-full" >
{ {
capitalizeAndInsertSpacesBeforeCaps ( veriClaim . claimType || "" )
serverUtil . capitalizeAndInsertSpacesBeforeCaps (
veriClaim . claimType || "" ,
)
} }
< button
v - if = "canEditClaim"
@ -137,7 +139,7 @@
>
This fulfills
{ {
capitalizeAndInsertSpacesBeforeCapsWithAPrefix (
serverUtil . capitalizeAndInsertSpacesBeforeCapsWithAPrefix (
detailsForGiveOfferFulfillment . offerType || "Offer" ,
)
} }
@ -811,34 +813,6 @@ export default class ClaimView extends Vue {
this . canShare = ! ! navigator . share ;
}
/ * *
* Formats type string for display by adding spaces before capitals
* Optionally adds a prefix
*
* @ param text - Text to format
* @ param prefix - Optional prefix to add
* @ returns Formatted string
* /
capitalizeAndInsertSpacesBeforeCapsWithAPrefix ( text : string ) : string {
const word = this . capitalizeAndInsertSpacesBeforeCaps ( text ) ;
if ( word ) {
/ / i f t h e w o r d s t a r t s w i t h a v o w e l , u s e " a n " i n s t e a d o f " a "
const firstLetter = word [ 0 ] . toLowerCase ( ) ;
const vowels = [ "a" , "e" , "i" , "o" , "u" ] ;
const particle = vowels . includes ( firstLetter ) ? "an" : "a" ;
return particle + " " + word ;
} else {
return "" ;
}
}
/ / i n s e r t a s p a c e b e f o r e a n y c a p i t a l l e t t e r s e x c e p t t h e i n i t i a l l e t t e r
/ / ( a n d c a p i t a l i z e i n i t i a l l e t t e r , j u s t i n c a s e )
capitalizeAndInsertSpacesBeforeCaps ( text : string ) : string {
if ( ! text ) return "" ;
return text [ 0 ] . toUpperCase ( ) + text . substr ( 1 ) . replace ( /([A-Z])/g , " $1" ) ;
}
totalConfirmers ( ) {
return (
this . numConfsNotVisible +