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] I want to refactor and add js docs comment inside common/utils methods exclude commonUtils.js #1550

Closed
5 tasks done
saddamhr opened this issue Oct 12, 2024 · 3 comments · Fixed by #1553
Closed
5 tasks done
Assignees
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: refactor need to refactor codebase hacktoberfest

Comments

@saddamhr
Copy link
Contributor

File Name

src/common/utils

Reason for Refactoring the Code

General reasons:

  • Readability: The code lacks readability due to non-descriptive variable names and a lack of clear structure.
  • Maintainability: The code is not easily maintainable, as changing the date formatting would require modifications in multiple places.
  • Performance: The code is not optimized for performance, with potentially costly operations like splitting the date string into an array and incorrect date object instantiation.

Individual file reasons:

  • In coverImageUtil.js will add the following
    • error handling
    • js docs comment missing
  • In fakeUser.js will add the following
    • Avoid unnecessary imports: Since faker.image.urlLoremFlickr is deprecated and faker.image provides other image generators, I replaced it with faker.image.nature() for a cleaner solution.
    • Removed redundant Array.from(Array()): Simplified array generation using Array(THRESHOLD).fill(null).map(...).
    • js docs comment
  • In formatCount.ts will add the following
    • DRY (Don't Repeat Yourself): Avoids repetitive parsing of the viewCount.
    • Early return in formatViewCount: Added a return for cases where the viewCount is less than 1,000.
    • Optimized handling for duration: Simplified the construction of the formatted time string.
    • js docs comment

Record

@saddamhr saddamhr added 💻 aspect: code Concerns the software code in the repository 🚦status: awaiting triage Has not been triaged & therefore, not ready for work 🛠 goal: refactor need to refactor codebase labels Oct 12, 2024
Copy link

Hey! contributor, thank you for opening an Issue 🎉.

@reactplay/maintainers will review your submission soon and give you helpful feedback. If you're interested in continuing your contributions to open source and want to be a part of a welcoming and fantastic community, we invite you to join our ReactPlay Discord Community.
Show your support by starring ⭐ this repository. Thank you and we appreciate your contribution to open source!
Stale Marking : After 30 days of inactivity this issue/PR will be marked as stale issue/PR and it will be closed and locked in 7 days if no further activity occurs.

@priyankarpal priyankarpal added hacktoberfest and removed 🚦status: awaiting triage Has not been triaged & therefore, not ready for work labels Oct 12, 2024
@priyankarpal
Copy link
Member

sure assigned to you

@PriteshKiri
Copy link
Contributor

Thanks for your contribution @saddamhr 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: refactor need to refactor codebase hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants