mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-23 09:40:33 +03:00
Merge pull request #286 from Livog/master
Bail on empty objects sent to the tagGenerator function
This commit is contained in:
@@ -13,6 +13,7 @@ export default function _tagGenerator (options = {}) {
|
|||||||
text ({ body = false } = {}) {
|
text ({ body = false } = {}) {
|
||||||
// build a string containing all tags of this type
|
// build a string containing all tags of this type
|
||||||
return tags.reduce((tagsStr, tag) => {
|
return tags.reduce((tagsStr, tag) => {
|
||||||
|
if (Object.keys(tag).length === 0) return tagsStr // Bail on empty tag object
|
||||||
if (!!tag.body !== body) return tagsStr
|
if (!!tag.body !== body) return tagsStr
|
||||||
// build a string containing all attributes of this tag
|
// build a string containing all attributes of this tag
|
||||||
const attrs = Object.keys(tag).reduce((attrsStr, attr) => {
|
const attrs = Object.keys(tag).reduce((attrsStr, attr) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user