visible/visible

View on GitHub
packages/@visi/core/src/utils/find-html.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Node, NodeWithChildren } from 'domhandler';
import { findOne } from 'domutils';

export const findHTML = (nodes: Node[]): NodeWithChildren | null => {
  return findOne(
    (element) => {
      return element.tagName === 'html';
    },
    nodes,
    true,
  );
};