mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 11:50:35 +03:00
fix: prefer includes over indexOf
This commit is contained in:
@@ -14,7 +14,7 @@ export default function updateAttribute({ attribute } = {}, attrs, tag) {
|
|||||||
const val = attrs[attr] || ''
|
const val = attrs[attr] || ''
|
||||||
tag.setAttribute(attr, val)
|
tag.setAttribute(attr, val)
|
||||||
|
|
||||||
if (vueMetaAttrs.indexOf(attr) === -1) {
|
if (!vueMetaAttrs.includes(attr)) {
|
||||||
vueMetaAttrs.push(attr)
|
vueMetaAttrs.push(attr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export default function updateTag({ attribute, tagIDKeyName } = {}, type, tags,
|
|||||||
} else {
|
} else {
|
||||||
newElement.appendChild(document.createTextNode(tag.cssText))
|
newElement.appendChild(document.createTextNode(tag.cssText))
|
||||||
}
|
}
|
||||||
} else if ([tagIDKeyName, 'body'].indexOf(attr) !== -1) {
|
} else if ([tagIDKeyName, 'body'].includes(attr)) {
|
||||||
const _attr = `data-${attr}`
|
const _attr = `data-${attr}`
|
||||||
const value = (typeof tag[attr] === 'undefined') ? '' : tag[attr]
|
const value = (typeof tag[attr] === 'undefined') ? '' : tag[attr]
|
||||||
newElement.setAttribute(_attr, value)
|
newElement.setAttribute(_attr, value)
|
||||||
|
|||||||
@@ -122,11 +122,11 @@ export default function getMetaInfo({ keyName, tagIDKeyName, metaTemplateKeyName
|
|||||||
|
|
||||||
// sanitizes potentially dangerous characters
|
// sanitizes potentially dangerous characters
|
||||||
const escape = info => Object.keys(info).reduce((escaped, key) => {
|
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]
|
const tagID = info[tagIDKeyName]
|
||||||
|
|
||||||
if (!isDisabled && tagID) {
|
if (!isDisabled && tagID) {
|
||||||
isDisabled = refByTagID && refByTagID[tagID] && refByTagID[tagID].indexOf(key) > -1
|
isDisabled = refByTagID && refByTagID[tagID] && refByTagID[tagID].includes(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
const val = info[key]
|
const val = info[key]
|
||||||
|
|||||||
Reference in New Issue
Block a user