Skip to content

Commit

Permalink
Merge pull request #801 from CommitChange/ReadableKind
Browse files Browse the repository at this point in the history
Add proper return types
  • Loading branch information
wwahammy authored Oct 16, 2023
2 parents b85e831 + d77e5c4 commit f688367
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions javascripts/src/lib/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ export function numberWithCommas(n:string|number):string {
return String(n).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
}

export function camelToWords(str:string, os?:any) {
export function camelToWords(str:string, os?:any):string {
if(!str) return str
return str.replace(/([A-Z])/g, " $1")
}

export function readableKind(kind:string) {
export function readableKind(kind:string):string {
if (kind === "Donation") return "One-Time Donation"
else if (kind === "OffsitePayment") return "Offsite Donation"
else if (kind === "Ticket") return "Ticket Purchase"
Expand All @@ -64,7 +64,7 @@ export function readableKind(kind:string) {



export function readableInterval(interval:number, time_unit:string) {
export function readableInterval(interval:number, time_unit:string):string {
if(interval === 1) return time_unit + 'ly'
if(interval === 4 && time_unit === 'year') return 'quarterly'
if(interval === 2 && time_unit === 'year') return 'biannually'
Expand Down

0 comments on commit f688367

Please sign in to comment.