Skip to content

refactor(content-type-parser): improve clarity with renamed parameter… #6259

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jaidenbose
Copy link

Summary

This PR improves the readability and maintainability of the buildContentTypeParser function by:

  • Renaming the parameter from c to sourceParser for better clarity.
  • Renaming the local variable to clonedParser to better reflect its purpose.

No functional changes were made; behavior remains the same.

Motivation

Clear variable names and documentation help future contributors understand the code quickly and reduce cognitive load.


Thank you for considering this small but important readability improvement!

Copy link
Member

@jean-michelet jean-michelet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Plz, run the linter before pushing.
Can you also fix the conflicts?

Comment on lines +334 to +340
function buildContentTypeParser(sourceParser) {
const clonedParser = new ContentTypeParser()
clonedParser[kDefaultJsonParse] = sourceParser[kDefaultJsonParse]
clonedParser.customParsers = new Map(sourceParser.customParsers.entries())
clonedParser.parserList = sourceParser.parserList.slice()
clonedParser.parserRegExpList = sourceParser.parserRegExpList.slice()
return clonedParser
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think clonedParser is a meaningful name, we're not cloning anything here.
We're creating a new parser from an existing parser, this is semantically different.

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

Successfully merging this pull request may close these issues.

2 participants