diff --git a/src/client/updateClientMetaInfo.js b/src/client/updateClientMetaInfo.js index 45776b3d..e7bb46ad 100644 --- a/src/client/updateClientMetaInfo.js +++ b/src/client/updateClientMetaInfo.js @@ -28,22 +28,22 @@ export default function updateClientMetaInfo(options = {}, newInfo) { const addedTags = {} const removedTags = {} - Object.keys(newInfo).forEach((type) => { + for (const type in newInfo) { // ignore these if (metaInfoOptionKeys.includes(type)) { - return + continue } if (type === 'title') { // update the title updateTitle(newInfo.title) - return + continue } if (metaInfoAttributeKeys.includes(type)) { const tagName = type.substr(0, 4) updateAttribute(options, newInfo[type], getTag(tags, tagName)) - return + continue } const { oldTags, newTags } = updateTag( @@ -58,7 +58,7 @@ export default function updateClientMetaInfo(options = {}, newInfo) { addedTags[type] = newTags removedTags[type] = oldTags } - }) + } return { addedTags, removedTags } } else { diff --git a/src/server/generators/tag.js b/src/server/generators/tag.js index 8127c9d4..1740154f 100644 --- a/src/server/generators/tag.js +++ b/src/server/generators/tag.js @@ -13,7 +13,9 @@ export default function tagGenerator({ attribute, tagIDKeyName } = {}, type, tag text({ body = false } = {}) { // build a string containing all tags of this type return tags.reduce((tagsStr, tag) => { - if (Object.keys(tag).length === 0) { + const tagKeys = Object.keys(tag) + + if (tagKeys.length === 0) { return tagsStr // Bail on empty tag object } @@ -22,7 +24,7 @@ export default function tagGenerator({ attribute, tagIDKeyName } = {}, type, tag } // build a string containing all attributes of this tag - const attrs = Object.keys(tag).reduce((attrsStr, attr) => { + const attrs = tagKeys.reduce((attrsStr, attr) => { // these attributes are treated as children on the tag if (tagAttributeAsInnerContent.includes(attr) || attr === 'once') { return attrsStr