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

chore: remove redundant code in method hyphenate #6555

Closed
wants to merge 1 commit into from
Closed

Conversation

ulivz
Copy link
Member

@ulivz ulivz commented Sep 9, 2017

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

When I debugged the source code, I found these positions that defined a method hyphenate, and the source code as follows:

/**
 * Hyphenate a camelCase string.
 */
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
  return str
    .replace(hyphenateRE, '$1-$2')
    .replace(hyphenateRE, '$1-$2')
    .toLowerCase()
});

It will caused all the 6 output files

Just this method is used to change the camelCase to camel-case, So, If the second replace is not necessary. And take extra caused execution time.

Sorry, something went wrong.

@ulivz ulivz changed the title [Enhancement] Remove redundant code in method hyphenate Enhancement: remove redundant code in method hyphenate Sep 9, 2017
@ulivz ulivz closed this Sep 9, 2017
@ulivz ulivz reopened this Sep 9, 2017
@ulivz ulivz changed the title Enhancement: remove redundant code in method hyphenate chore: remove redundant code in method hyphenate Sep 11, 2017
@yyx990803
Copy link
Member

Thanks for the PR! This piece of code has already been addressed by a previous PR (#6274). Also, the files in dist and packages are auto generated during release builds - PRs should only modify code in src.

@yyx990803 yyx990803 closed this Sep 11, 2017
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.

None yet

2 participants