Skip to content

Instantly share code, notes, and snippets.

@renatocfrancisco
Created October 16, 2023 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renatocfrancisco/a0008bc3b7392a8f7a049574cba76fd7 to your computer and use it in GitHub Desktop.
Save renatocfrancisco/a0008bc3b7392a8f7a049574cba76fd7 to your computer and use it in GitHub Desktop.
A Javascript const function
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