Explorar el Código

replace .forEach with .some on x-bind checkbox

Reed Jones hace 5 años
padre
commit
6a40aa9dde
Se han modificado 1 ficheros con 1 adiciones y 8 borrados
  1. 1 8
      src/directives/bind.js

+ 1 - 8
src/directives/bind.js

@@ -23,14 +23,7 @@ export function handleAttributeBindingDirective(component, el, attrName, express
                 // I'm purposely not using Array.includes here because it's
                 // strict, and because of Numeric/String mis-casting, I
                 // want the "includes" to be "fuzzy".
-                let valueFound = false
-                value.forEach(val => {
-                    if (val == el.value) {
-                        valueFound = true
-                    }
-                })
-
-                el.checked = valueFound
+                el.checked = value.some(val => val == el.value)
             } else {
                 el.checked = !! value
             }