diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index e865481..5e78a08 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node_version: [18.x, 20.x, 22.x] + node_version: [18.x, 20.x, 22.x, 23.x] steps: - uses: actions/checkout@v4 diff --git a/package.json b/package.json index 063157b..e8c612e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "8.0.14", + "version": "8.0.15", "name": "@extractus/article-extractor", "description": "To extract main article from given URL", "homepage": "https://github.com/extractus/article-extractor", @@ -38,7 +38,7 @@ }, "devDependencies": { "@types/sanitize-html": "^2.13.0", - "eslint": "^9.12.0", + "eslint": "^9.13.0", "globals": "^15.11.0", "https-proxy-agent": "^7.0.5", "nock": "^13.5.5" diff --git a/src/utils/extractLdSchema.js b/src/utils/extractLdSchema.js index 6c34976..6a05c0f 100644 --- a/src/utils/extractLdSchema.js +++ b/src/utils/extractLdSchema.js @@ -59,7 +59,8 @@ export default (document, entry) => { const ldSchemas = document.querySelectorAll('script[type="application/ld+json"]') ldSchemas.forEach(ldSchema => { const ldJson = parseJson(ldSchema.textContent.replace(/[\n\r\t]/g, '')) - const isAllowedLdJsonType = typeSchemas.includes(ldJson['@type']?.toLowerCase()) + const ldJsonType = ldJson['@type']?.toLowerCase() || null + const isAllowedLdJsonType = ldJsonType ? typeSchemas.includes(ldJsonType) : false if (ldJson && isAllowedLdJsonType) { Object.entries(attributeLists).forEach(([key, attr]) => {