Skip to content

Commit 6bbcf74

Browse files
committed
fix: prefer includes over indexOf
1 parent f329d04 commit 6bbcf74

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/client/updaters/attribute.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function updateAttribute({ attribute } = {}, attrs, tag) {
1414
const val = attrs[attr] || ''
1515
tag.setAttribute(attr, val)
1616

17-
if (vueMetaAttrs.indexOf(attr) === -1) {
17+
if (!vueMetaAttrs.includes(attr)) {
1818
vueMetaAttrs.push(attr)
1919
}
2020

src/client/updaters/tag.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function updateTag({ attribute, tagIDKeyName } = {}, type, tags,
4444
} else {
4545
newElement.appendChild(document.createTextNode(tag.cssText))
4646
}
47-
} else if ([tagIDKeyName, 'body'].indexOf(attr) !== -1) {
47+
} else if ([tagIDKeyName, 'body'].includes(attr)) {
4848
const _attr = `data-${attr}`
4949
const value = (typeof tag[attr] === 'undefined') ? '' : tag[attr]
5050
newElement.setAttribute(_attr, value)

src/shared/getMetaInfo.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ export default function getMetaInfo({ keyName, tagIDKeyName, metaTemplateKeyName
122122

123123
// sanitizes potentially dangerous characters
124124
const escape = info => Object.keys(info).reduce((escaped, key) => {
125-
let isDisabled = ref && ref.indexOf(key) > -1
125+
let isDisabled = ref && ref.includesOf(key)
126126
const tagID = info[tagIDKeyName]
127127

128128
if (!isDisabled && tagID) {
129-
isDisabled = refByTagID && refByTagID[tagID] && refByTagID[tagID].indexOf(key) > -1
129+
isDisabled = refByTagID && refByTagID[tagID] && refByTagID[tagID].includes(key)
130130
}
131131

132132
const val = info[key]

0 commit comments

Comments
 (0)