diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts
index 735252f7..cdc516b1 100644
--- a/src/libs/endorserServer.ts
+++ b/src/libs/endorserServer.ts
@@ -1140,6 +1140,28 @@ export const capitalizeAndInsertSpacesBeforeCaps = (text: string) => {
: text[0].toUpperCase() + text.substr(1).replace(/([A-Z])/g, " $1");
};
+/**
+ * Formats type string for display by adding spaces before capitals
+ * and optionally adds an appropriate article prefix (a/an)
+ *
+ * @param text - Text to format
+ * @returns Formatted string with article prefix
+ */
+export const capitalizeAndInsertSpacesBeforeCapsWithAPrefix = (
+ text: string,
+): string => {
+ const word = capitalizeAndInsertSpacesBeforeCaps(text);
+ if (word) {
+ // if the word starts with a vowel, use "an" instead of "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 "";
+ }
+};
+
/**
return readable summary of claim, or something generic
diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue
index 55ca6744..3653861d 100644
--- a/src/views/ClaimView.vue
+++ b/src/views/ClaimView.vue
@@ -24,7 +24,9 @@
{{
- capitalizeAndInsertSpacesBeforeCaps(veriClaim.claimType || "")
+ serverUtil.capitalizeAndInsertSpacesBeforeCaps(
+ veriClaim.claimType || "",
+ )
}}