Created
October 16, 2023 17:50
-
-
Save renatocfrancisco/a0008bc3b7392a8f7a049574cba76fd7 to your computer and use it in GitHub Desktop.
A Javascript const function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formatCurrentPlanType = (type) => { | |
const planType = { | |
free: 'Free', | |
individual: 'Individual', | |
team: 'Team', | |
enterprise: 'Enterprise', | |
'enterprise-member': 'Enterprise Member' | |
}; | |
return planType[type] || 'Free'; | |
}; | |
console.log(formatCurrentPlanType("free")); // Free | |
console.log(formatCurrentPlanType("individual")); // Individual | |
console.log(formatCurrentPlanType("team")); // Team | |
console.log(formatCurrentPlanType("enterprise")); // Enterprise | |
console.log(formatCurrentPlanType("enterprise-member")); // Enterprise Member | |
console.log(formatCurrentPlanType("")); // Free | |
console.log(formatCurrentPlanType("test")); // Free |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment