summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-25 21:23:11 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-25 22:12:00 -0500
commit6bd714fec0437413d0731e0d346f52f8abe55cd2 (patch)
treebf301df92058cfc7bf9a24d5d3321ceda2e6545a /ext/bg/js
parent798517cdf1e346e43e66b2afb43cdf4bda1106e9 (diff)
Use Map to avoid using for in
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/settings/conditions-ui.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/bg/js/settings/conditions-ui.js b/ext/bg/js/settings/conditions-ui.js
index 5a271321..63e01861 100644
--- a/ext/bg/js/settings/conditions-ui.js
+++ b/ext/bg/js/settings/conditions-ui.js
@@ -235,10 +235,10 @@ ConditionsUI.Condition = class Condition {
updateInput() {
const conditionDescriptors = this.parent.parent.conditionDescriptors;
const {type, operator} = this.condition;
- const props = {
- placeholder: '',
- type: 'text'
- };
+ const props = new Map([
+ ['placeholder', ''],
+ ['type', 'text']
+ ]);
const objects = [];
if (hasOwn(conditionDescriptors, type)) {
@@ -252,20 +252,20 @@ ConditionsUI.Condition = class Condition {
for (const object of objects) {
if (hasOwn(object, 'placeholder')) {
- props.placeholder = object.placeholder;
+ props.set('placeholder', object.placeholder);
}
if (object.type === 'number') {
- props.type = 'number';
+ props.set('type', 'number');
for (const prop of ['step', 'min', 'max']) {
if (hasOwn(object, prop)) {
- props[prop] = object[prop];
+ props.set(prop, object[prop]);
}
}
}
}
- for (const prop in props) {
- this.input.prop(prop, props[prop]);
+ for (const [prop, value] of props.entries()) {
+ this.input.prop(prop, value);
}
const {valid} = this.validateValue(this.condition.value);