Skip to content

Commit

Permalink
fix(tagDedupeKey): cast value as string
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Nov 11, 2022
1 parent 1aa17ee commit 6f69b85
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/zhead/src/tagDedupeKey.ts
Expand Up @@ -28,9 +28,12 @@ export function tagDedupeKey<T extends HeadTag>(tag: T): string | false {
name.push(...['name', 'property', 'http-equiv'])
for (const n of name) {
// open graph props can have multiple tags with the same property
if (typeof props[n] !== 'undefined' && !ArrayMetaProperties.findIndex(p => !props[n].startsWith(p))) {
if (typeof props[n] !== 'undefined') {
const val = String(props[n])
if (ArrayMetaProperties.findIndex(p => val.startsWith(p)) !== -1)
return false
// for example: meta-name-description
return `${tagName}:${n}:${props[n]}`
return `${tagName}:${n}:${val}`
}
}
return false
Expand Down

0 comments on commit 6f69b85

Please sign in to comment.