2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-12 00:42:25 +03:00

fix: prefer includes over indexOf

This commit is contained in:
pimlie
2019-02-10 09:03:14 +01:00
parent f329d04d03
commit 6bbcf74c94
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ export default function updateAttribute({ attribute } = {}, attrs, tag) {
const val = attrs[attr] || ''
tag.setAttribute(attr, val)
if (vueMetaAttrs.indexOf(attr) === -1) {
if (!vueMetaAttrs.includes(attr)) {
vueMetaAttrs.push(attr)
}
+1 -1
View File
@@ -44,7 +44,7 @@ export default function updateTag({ attribute, tagIDKeyName } = {}, type, tags,
} else {
newElement.appendChild(document.createTextNode(tag.cssText))
}
} else if ([tagIDKeyName, 'body'].indexOf(attr) !== -1) {
} else if ([tagIDKeyName, 'body'].includes(attr)) {
const _attr = `data-${attr}`
const value = (typeof tag[attr] === 'undefined') ? '' : tag[attr]
newElement.setAttribute(_attr, value)
+2 -2
View File
@@ -122,11 +122,11 @@ export default function getMetaInfo({ keyName, tagIDKeyName, metaTemplateKeyName
// sanitizes potentially dangerous characters
const escape = info => Object.keys(info).reduce((escaped, key) => {
let isDisabled = ref && ref.indexOf(key) > -1
let isDisabled = ref && ref.includesOf(key)
const tagID = info[tagIDKeyName]
if (!isDisabled && tagID) {
isDisabled = refByTagID && refByTagID[tagID] && refByTagID[tagID].indexOf(key) > -1
isDisabled = refByTagID && refByTagID[tagID] && refByTagID[tagID].includes(key)
}
const val = info[key]