Use Map to avoid using for in
This commit is contained in:
parent
798517cdf1
commit
6bd714fec0
@ -235,10 +235,10 @@ ConditionsUI.Condition = class Condition {
|
|||||||
updateInput() {
|
updateInput() {
|
||||||
const conditionDescriptors = this.parent.parent.conditionDescriptors;
|
const conditionDescriptors = this.parent.parent.conditionDescriptors;
|
||||||
const {type, operator} = this.condition;
|
const {type, operator} = this.condition;
|
||||||
const props = {
|
const props = new Map([
|
||||||
placeholder: '',
|
['placeholder', ''],
|
||||||
type: 'text'
|
['type', 'text']
|
||||||
};
|
]);
|
||||||
|
|
||||||
const objects = [];
|
const objects = [];
|
||||||
if (hasOwn(conditionDescriptors, type)) {
|
if (hasOwn(conditionDescriptors, type)) {
|
||||||
@ -252,20 +252,20 @@ ConditionsUI.Condition = class Condition {
|
|||||||
|
|
||||||
for (const object of objects) {
|
for (const object of objects) {
|
||||||
if (hasOwn(object, 'placeholder')) {
|
if (hasOwn(object, 'placeholder')) {
|
||||||
props.placeholder = object.placeholder;
|
props.set('placeholder', object.placeholder);
|
||||||
}
|
}
|
||||||
if (object.type === 'number') {
|
if (object.type === 'number') {
|
||||||
props.type = 'number';
|
props.set('type', 'number');
|
||||||
for (const prop of ['step', 'min', 'max']) {
|
for (const prop of ['step', 'min', 'max']) {
|
||||||
if (hasOwn(object, prop)) {
|
if (hasOwn(object, prop)) {
|
||||||
props[prop] = object[prop];
|
props.set(prop, object[prop]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const prop in props) {
|
for (const [prop, value] of props.entries()) {
|
||||||
this.input.prop(prop, props[prop]);
|
this.input.prop(prop, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const {valid} = this.validateValue(this.condition.value);
|
const {valid} = this.validateValue(this.condition.value);
|
||||||
|
Loading…
Reference in New Issue
Block a user