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

Don't use javascript reserved word as Object keys #154

Open
harry1989 opened this issue Jan 10, 2019 · 1 comment
Open

Don't use javascript reserved word as Object keys #154

harry1989 opened this issue Jan 10, 2019 · 1 comment

Comments

@harry1989
Copy link

Hi,

I have observed the block.js file makes use of javascript keywords as objects keys. Ref: here.

Although this isn't prohibited, it isn't the correct thing to do.

  • Editors highlight is wrongly
  • Code minifiers have trouble with them.

Its best to not use them at all, in this scenarios it can be named as proceed. i.e the function returns. If that's not possible, at least you can quote them as below.

from

var object  = {
  continue: function(){}
}

object.continue();

to

var object  = {
  'continue': function(){}
}
object['continue']()

Please let me know how you wish to address this, I'll submit a PR with the changes.

@jgm
Copy link
Member

jgm commented Jan 11, 2019 via email

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

2 participants