Skip to content

Commit

Permalink
Merge pull request alpinejs#513 from reed-jones/master
Browse files Browse the repository at this point in the history
replace .forEach with .some on x-bind checkbox
  • Loading branch information
calebporzio authored May 21, 2020
2 parents b6f2b24 + 6a40aa9 commit 88898db
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/directives/bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 88898db

Please sign in to comment.