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

Function _nodeTypeOf

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

Source from the content-addressed store, hash-verified

1980 * @return the node type, or null if value is not a DOM node
1981 */
1982 const _nodeTypeOf = function (value: unknown): number | null {
1983 if (!getNodeType || typeof value !== 'object' || value === null) {
1984 return null;
1985 }
1986
1987 try {
1988 const nodeType = getNodeType(value as Node);
1989 return typeof nodeType === 'number' ? nodeType : null;
1990 } catch (_) {
1991 return null;
1992 }
1993 };
1994
1995 const _isDocumentFragment = function (value: unknown): boolean {
1996 return _nodeTypeOf(value) === NODE_TYPE.documentFragment;

Callers 2

_isDocumentFragmentFunction · 0.85
_isNodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected