Skip to content

Commit

Permalink
Merge pull request #112 from extractus/7.0.6
Browse files Browse the repository at this point in the history
v7.0.6
  • Loading branch information
ndaidong authored Sep 12, 2023
2 parents 11e373c + 8e0f34a commit a5ac5f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node_version: [14.x, 16.x, 18.x, 20.x]
node_version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"types": "./index.d.ts",
"engines": {
"node": ">= 15"
"node": ">= 16"
},
"scripts": {
"lint": "eslint .",
Expand Down
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 a5ac5f2

Please sign in to comment.