Skip to main content

Function: isYoutubeEmbed()

isYoutubeEmbed(node): boolean

Defined in: packages/core/src/dom/index.ts:187

Checks if the node is an youtube embed

This function expects to be used with DOMNode objects from html-react-parser, which is the underlying parser used by BlocksRenderer.

Usage

import { isYoutubeEmbed } from '@headstartwp/core';

<BlocksRenderer html={html}>
<MyYoutubeBlock
test={isYoutubeEmbed}
/>
</BlocksRenderer>

Parameters

node

DOMNode

The node to test

Returns

boolean

true if the node is a youtube embed