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: replaced usage of indexOf(string) === 0 with startsWith(string) #20893

Closed
wants to merge 1 commit into from

Conversation

whiteand
Copy link

Summary

I think it will be more readable to use .startsWith(text) string method instead of .indexOf(text) === 0

Test Plan

I think it's very simple to check that this is the same code as before but more readable(at least in my opinion)

@facebook-github-bot
Copy link

Hi @whiteand!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@sizebot
Copy link

sizebot commented Feb 26, 2021

Comparing: 0cf9fc1...6c812c2

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 122.55 kB 122.55 kB +0.01% 39.48 kB 39.48 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 129.13 kB 129.13 kB +0.01% 41.53 kB 41.53 kB
facebook-www/ReactDOM-prod.classic.js = 406.12 kB 406.12 kB = 75.38 kB 75.39 kB
facebook-www/ReactDOM-prod.modern.js = 394.47 kB 394.47 kB = 73.49 kB 73.49 kB
facebook-www/ReactDOMForked-prod.classic.js = 406.13 kB 406.13 kB = 75.38 kB 75.39 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 6c812c2

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@bvaughn
Copy link
Contributor

bvaughn commented Feb 26, 2021

React aims to support even older browsers like IE 9 and 10 with some critical polyfills like Map and Set. startsWith is a nicer method to read, yes, but it's a breaking change that is not worth the downside of breaking older browsers IMO.

Thanks though!

@bvaughn bvaughn closed this Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants