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

[DOC]Style Guid : Why is this example used of "indexOf" than "includes" on Prop definitions? #2877

Open
mymactive opened this issue Sep 13, 2021 · 0 comments

Comments

@mymactive
Copy link

mymactive commented Sep 13, 2021

Hi,
I feel a bit uncomfortable code on Props definitions.
This example is following:

// Even better!
props: {
  status: {
    type: String,
    required: true,
    validator: function (value) {
      return [
        'syncing',
        'synced',
        'version-conflict',
        'error'
      ].indexOf(value) !== -1
    }
  }
}

For this example, "indexOf" is used than "includes".
Semantically, I think "includes" is natural than "indexOf" in this context.
Would you teach the reason why "indexOf" is better than "includes"?
If "includes" is better, I will edit the style guide.

We love Vue and work application development using Vue.
Thank you for contributors and communities for Vue!

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

No branches or pull requests

1 participant