node-html-parser
Advanced tools
Comparing version 3.0.2 to 3.0.3
import NodeType from './nodes/type'; | ||
function isTag(node) { | ||
return node.nodeType === NodeType.ELEMENT_NODE; | ||
return node && node.nodeType === NodeType.ELEMENT_NODE; | ||
} | ||
function getAttributeValue(elem, name) { | ||
return elem.getAttribute(name); | ||
return isTag(elem) ? elem.getAttribute(name) : undefined; | ||
} | ||
function getName(elem) { | ||
return (elem.rawTagName || '').toLowerCase(); | ||
return ((elem && elem.rawTagName) || '').toLowerCase(); | ||
} | ||
function getChildren(node) { | ||
return node.childNodes; | ||
return node && node.childNodes; | ||
} | ||
function getParent(node) { | ||
return node.parentNode; | ||
return node ? node.parentNode : null; | ||
} | ||
@@ -17,0 +17,0 @@ function getText(node) { |
@@ -98,15 +98,15 @@ var __extends = (this && this.__extends) || (function () { | ||
function isTag(node) { | ||
return node.nodeType === type_2.default.ELEMENT_NODE; | ||
return node && node.nodeType === type_2.default.ELEMENT_NODE; | ||
} | ||
function getAttributeValue(elem, name) { | ||
return elem.getAttribute(name); | ||
return isTag(elem) ? elem.getAttribute(name) : undefined; | ||
} | ||
function getName(elem) { | ||
return (elem.rawTagName || '').toLowerCase(); | ||
return ((elem && elem.rawTagName) || '').toLowerCase(); | ||
} | ||
function getChildren(node) { | ||
return node.childNodes; | ||
return node && node.childNodes; | ||
} | ||
function getParent(node) { | ||
return node.parentNode; | ||
return node ? node.parentNode : null; | ||
} | ||
@@ -113,0 +113,0 @@ function getText(node) { |
@@ -8,15 +8,15 @@ "use strict"; | ||
function isTag(node) { | ||
return node.nodeType === type_1.default.ELEMENT_NODE; | ||
return node && node.nodeType === type_1.default.ELEMENT_NODE; | ||
} | ||
function getAttributeValue(elem, name) { | ||
return elem.getAttribute(name); | ||
return isTag(elem) ? elem.getAttribute(name) : undefined; | ||
} | ||
function getName(elem) { | ||
return (elem.rawTagName || '').toLowerCase(); | ||
return ((elem && elem.rawTagName) || '').toLowerCase(); | ||
} | ||
function getChildren(node) { | ||
return node.childNodes; | ||
return node && node.childNodes; | ||
} | ||
function getParent(node) { | ||
return node.parentNode; | ||
return node ? node.parentNode : null; | ||
} | ||
@@ -23,0 +23,0 @@ function getText(node) { |
{ | ||
"name": "node-html-parser", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151190