MCPcopy Create free account
hub / github.com/cure53/DOMPurify / _nodeTypeOf

Function _nodeTypeOf

src/purify.ts:1785–1796  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

1783 * @return the node type, or null if value is not a DOM node
1784 */
1785 const _nodeTypeOf = function (value: unknown): number | null {
1786 if (!getNodeType || typeof value !== 'object' || value === null) {
1787 return null;
1788 }
1789
1790 try {
1791 const nodeType = getNodeType(value as Node);
1792 return typeof nodeType === 'number' ? nodeType : null;
1793 } catch (_) {
1794 return null;
1795 }
1796 };
1797
1798 const _isDocumentFragment = function (value: unknown): boolean {
1799 return _nodeTypeOf(value) === NODE_TYPE.documentFragment;

Callers 2

_isDocumentFragmentFunction · 0.85
_isNodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected