Skip to content

Swapping indexOf to includes in comparisons #1885

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

Merged
merged 1 commit into from
Aug 4, 2022

Conversation

oliver-mitchell
Copy link
Contributor

This proposal is to remove the usage of the indexOf method when testing for the presence of a given character in a string. While indexOf is compatible with IE, includes is friendlier to newer JavaScript developers and it improves code readability.

Description of Problem

indexOf is the legacy method of checking if a string contains a substring.

Proposed Solution

Removing usage of indexOf and replacing with includes

Additional Information

This proposal is to remove the usage of the `indexOf` method when testing for the presence of a given character in a string. While `indexOf` is compatible with IE, `includes` is friendlier to newer JavaScript developers and it improves code readability.
@netlify
Copy link

netlify bot commented Aug 4, 2022

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit e3d1bb4
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/62eb694001ec620008c4ee45
😎 Deploy Preview https://deploy-preview-1885--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@NataliaTepluhina NataliaTepluhina merged commit 1df1e0e into vuejs:main Aug 4, 2022
edimitchel referenced this pull request in vuejs-translations/docs-fr Aug 4, 2022
This proposal is to remove the usage of the `indexOf` method when testing for the presence of a given character in a string. While `indexOf` is compatible with IE, `includes` is friendlier to newer JavaScript developers and it improves code readability.
edimitchel referenced this pull request in vuejs-translations/docs-fr Aug 22, 2022
This proposal is to remove the usage of the `indexOf` method when testing for the presence of a given character in a string. While `indexOf` is compatible with IE, `includes` is friendlier to newer JavaScript developers and it improves code readability.

Co-authored-by: Oliver Mitchell <[email protected]>
edimitchel referenced this pull request in vuejs-translations/docs-fr Aug 22, 2022
…e/components/attrs.mdCo-authored-by: Natalia Tepluhina <[email protected]> (#42) (#43)

* Swapping `indexOf` to `includes` in comparisons (#1885)

This proposal is to remove the usage of the `indexOf` method when testing for the presence of a given character in a string. While `indexOf` is compatible with IE, `includes` is friendlier to newer JavaScript developers and it improves code readability.

* Minor lexical improvements to composables.md (#1875)

* Minor lexical improvements to composables.md

* Update src/guide/reusability/composables.md

Co-authored-by: skirtle <[email protected]>

Co-authored-by: skirtle <[email protected]>

* Missing 'the' in attrs.md (#1874)

* Missing 'the' in attrs.md

* Update src/guide/components/attrs.md

Co-authored-by: Natalia Tepluhina <[email protected]>

Co-authored-by: Oliver Mitchell <[email protected]>
Co-authored-by: mst101 <[email protected]>
Co-authored-by: skirtle <[email protected]>
Co-authored-by: Natalia Tepluhina <[email protected]>
edimitchel referenced this pull request in vuejs-translations/docs-fr Aug 22, 2022
…nts to composables.md* Update src/guide/reusability/composables.mdCo-authored-by: skirtle <[email protected]>Co-authored-by: skirtle <[email protected]> (#40) (#41)

* Swapping `indexOf` to `includes` in comparisons (#1885)

This proposal is to remove the usage of the `indexOf` method when testing for the presence of a given character in a string. While `indexOf` is compatible with IE, `includes` is friendlier to newer JavaScript developers and it improves code readability.

* Minor lexical improvements to composables.md (#1875)

* Minor lexical improvements to composables.md

* Update src/guide/reusability/composables.md

Co-authored-by: skirtle <[email protected]>

Co-authored-by: skirtle <[email protected]>

Co-authored-by: Oliver Mitchell <[email protected]>
Co-authored-by: mst101 <[email protected]>
Co-authored-by: skirtle <[email protected]>
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