Skip to content

Refactor: Extract Capitalization Logic into Reusable Utility Function #907

Open
@shining-bluemoon-11

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

Type

No type

Projects

  • Status

    In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions