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

Automatic creation of the chain of parent objects in the set-constant scriptlet, if necessary #413

Open
scripthunter7 opened this issue Mar 27, 2024 · 0 comments
Assignees

Comments

@scripthunter7
Copy link
Member

scripthunter7 commented Mar 27, 2024

Sometimes it happens that a constant needs to be set, for which parent object(s) must also be created.

For example, if I want to set foo.bar to a trueFunc, I have to do the following:

! First, create the 'foo' object
example.com#%#//scriptlet('set-constant', 'foo', 'emptyObj')
! Then, create the property
example.com#%#//scriptlet('set-constant', 'foo.bar', 'trueFunc')

However, perhaps the 2nd rule would be enough by itself:

  • if foo exists and is an object, simply set the bar property to trueFunc
  • if foo does not exist, simply create it as an empty object and then set the bar prop
  • if foo exists but is not an object, there are two options:
    • skip the execution of the scriptlet and do nothing
    • or overwrite it with an empty object (if possible) and then set the bar prop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants