diff --git a/lib/parse.ts b/lib/parse.ts index 758d0c7..5dc609f 100644 --- a/lib/parse.ts +++ b/lib/parse.ts @@ -82,18 +82,18 @@ export const parseGPXWithCustomParser = ( email: emailElement !== null ? { - id: emailElement.getAttribute("id") ?? "", - domain: - emailElement.getAttribute("domain") ?? "", - } + id: emailElement.getAttribute("id") ?? "", + domain: + emailElement.getAttribute("domain") ?? "", + } : null, link: linkElement !== null ? { - href: linkElement.getAttribute("href") ?? "", - text: getElementValue(linkElement, "text"), - type: getElementValue(linkElement, "type"), - } + href: linkElement.getAttribute("href") ?? "", + text: getElementValue(linkElement, "text"), + type: getElementValue(linkElement, "type"), + } : null, } } @@ -322,9 +322,7 @@ const getElementValue = (parent: Element, tag: string): string => { // Extract and return the value within the parent element if (element !== null) { - return element.innerHTML != undefined - ? element.innerHTML - : element.childNodes[0].textContent ?? "" + return element.firstChild?.textContent ?? element.innerHTML ?? "" } else return "" } diff --git a/package.json b/package.json index f8205fb..10f1a98 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@we-gold/gpxjs", "author": "Weaver Goldman ", "description": "GPX.js is a modern library for parsing GPX files and converting them to GeoJSON.", - "version": "1.0.9", + "version": "1.0.10", "type": "module", "license": "MIT", "repository": {