-
Notifications
You must be signed in to change notification settings - Fork 6
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
Usage of period for state name causes problem with global.state #1
Comments
Good idea. This global state becomes Javascript variables, and periods could be converted to objects, but they can clash. For example:
If we converted periods to objects it wouldn't work for |
One way to do it is to error if someone tries to enter a special character. Another would be to replace all special characters with |
I would deny special chars which can cause problems. According to JS coding standards following rules apply for variable naming: But you can keep this simpler if you like. |
Don't replace special chars automatically. It is better to error this that it has to be changed by the user. |
Would you try to support |
I would not support this as this is also not supported by naming convention. |
Useful website for validation https://mothereff.in/js-variables |
I'll probably use an npm module like is-valid-var-name, and let someone else keep up as JS changes |
Thanks for the feedback. Hope you're getting good use out of this node-red-contrib! |
Good idea to use the validation module. Your module is really useful. Thank you. |
State name validation added and published in 1.4.0. Thanks for your input! |
SET STATE NODE person.tom
DEBUG OUTPUT global.state.person.tom -> undefined
Support usage of special chars or white list allowed ones
The text was updated successfully, but these errors were encountered: