Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Extract Capitalization Logic into Reusable Utility Function #907

Closed
shining-bluemoon-11 opened this issue Feb 21, 2025 · 0 comments · Fixed by #917
Closed

Refactor: Extract Capitalization Logic into Reusable Utility Function #907

shining-bluemoon-11 opened this issue Feb 21, 2025 · 0 comments · Fixed by #917
Assignees
Labels

Comments

@shining-bluemoon-11
Copy link
Contributor

DESCRIPTION -

Refactor the code to create a reusable function for capitalizing the first letter and making the rest lowercase.

As discussed in the code review for #866 the capitalization logic for project level and type is currently implemented inline within the ProjectDetailsPage component. To improve code reusability, testability, and maintainability, this issue proposes extracting this logic into a separate utility function.

Current Implementation

The current code for capitalization is as follows:

project.level[0].toUpperCase() + project.level.slice(1).toLowerCase()

Proposed Changes

1. Create a new function in a utility file that performs the capitalization.
2. Replace the existing inline capitalization code in ProjectDetailsPage.js for project.level and project.type with calls to the new function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants