Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hast-util-is-element

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hast-util-is-element

hast utility to check if a node is a (certain) element

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1M
decreased by-5.72%
Maintainers
2
Weekly downloads
 
Created

What is hast-util-is-element?

The hast-util-is-element package is a utility for working with HAST (Hypertext Abstract Syntax Tree) nodes. It provides functions to check if a node is an element and optionally matches a given tag name. This is particularly useful when manipulating or inspecting HTML represented within JavaScript.

What are hast-util-is-element's main functionalities?

Check if a node is an element

This feature allows you to verify if a given node is an element node within a HAST structure. It's useful for filtering or processing nodes in a tree.

const isElement = require('hast-util-is-element');

const node = {type: 'element', tagName: 'div'};
console.log(isElement(node)); // Outputs: true

Check if a node is a specific element

This feature extends the basic check to allow for specification of the tag name. It's useful for finding or working with specific types of elements in a document.

const isElement = require('hast-util-is-element');

const node = {type: 'element', tagName: 'span'};
console.log(isElement(node, 'span')); // Outputs: true

Other packages similar to hast-util-is-element

Keywords

FAQs

Package last updated on 31 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc