Closed AdamWr closed 6 months ago
Currently it doesn't work correctly for falsy values.
falsy
Steps to reproduce:
example.org#%#//scriptlet('set-constant', 'foo.bar.test', 'true', '', '', 'true')
foo = { bar: { abc: {} } }; console.log('Original foo.bar - foo.bar.test:', foo.bar.test); foo.bar = { abc: {}, }; console.log('Rewritten foo.bar - foo.bar.test:', foo.bar.test);
or
foo.bar.test should returns true.
foo.bar.test
true
Probably currentObj && should be removed from: https://github.com/AdguardTeam/Scriptlets/blob/2f91f88c788222db147667c56aba74ebdc6e0c96/src/scriptlets/set-constant.js#L320
currentObj &&
Currently it doesn't work correctly for
falsy
values.Steps to reproduce:
Code:
or
Code:
```js foo = { bar: { abc: {} } }; console.log('Original foo.bar - foo.bar.test:', foo.bar.test); foo.bar = { abc: {}, test: false, }; console.log('Rewritten foo.bar - foo.bar.test:', foo.bar.test); ```foo.bar.test
should returnstrue
.Probably
currentObj &&
should be removed from: https://github.com/AdguardTeam/Scriptlets/blob/2f91f88c788222db147667c56aba74ebdc6e0c96/src/scriptlets/set-constant.js#L320