AdguardTeam / Scriptlets

AdGuard scriptlets library
GNU General Public License v3.0
138 stars 27 forks source link

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

Open scripthunter7 opened 3 months ago

scripthunter7 commented 3 months ago

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: