-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Description
Currently it doesn't work correctly for falsy values.
Steps to reproduce:
- Add this rule:
example.org#%#//scriptlet('set-constant', 'foo.bar.test', 'true', '', '', 'true')- Go to - https://example.org/
- In browser console run:
Code:
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
Code:
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 returns true.
Probably currentObj && should be removed from:
Scriptlets/src/scriptlets/set-constant.js
Line 320 in 2f91f88
| if (currentObj && index === array.length - 1 && currentObj !== constantValue) { |
Reactions are currently unavailable