Skip to content

Commit

Permalink
v7.0.6
Browse files Browse the repository at this point in the history
- Update dependencies
- Fix issue #111
  • Loading branch information
ndaidong committed Sep 12, 2023
1 parent 11e373c commit 3f4239c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/utils/normalizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export const getText = (val) => {
}

export const getLink = (val = [], id = '') => {
if (id && isValidUrl(id)) {
return id
}
if (isObject(id) && hasProperty(id, '@_isPermaLink') && id['@_isPermaLink'] === 'true') {
return getText(id)
}
Expand All @@ -45,7 +42,7 @@ export const getLink = (val = [], id = '') => {
})
return items.length > 0 ? items[0] : ''
}
return isString(val)
const url = isString(val)
? getText(val)
: isObject(val) && hasProperty(val, 'href')
? getText(val.href)
Expand All @@ -56,6 +53,8 @@ export const getLink = (val = [], id = '') => {
: isObject(val) && hasProperty(val, '_attributes')
? getText(val._attributes.href)
: isArray(val) ? getEntryLink(val) : ''

return url ? url : isValidUrl(id) ? id : ''
}

export const getPureUrl = (url, id = '', baseUrl) => {
Expand Down

0 comments on commit 3f4239c

Please sign in to comment.