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

hast-util-phrasing

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hast-util-phrasing

hast utility to check if a node is phrasing content

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
201K
increased by4.67%
Maintainers
2
Weekly downloads
 
Created

What is hast-util-phrasing?

The `hast-util-phrasing` package is a utility for working with phrasing content in the HAST (Hypertext Abstract Syntax Tree) format. It helps in identifying and manipulating phrasing content, which includes text and elements that can be found within paragraphs.

What are hast-util-phrasing's main functionalities?

Check if a node is phrasing content

This feature allows you to check if a given node is considered phrasing content. In this example, a text node is checked and returns true.

const { isPhrasing } = require('hast-util-phrasing');
const node = { type: 'text', value: 'Hello, world!' };
console.log(isPhrasing(node)); // true

Filter phrasing content from a list of nodes

This feature allows you to filter out only the phrasing content from a list of nodes. In this example, only the text node is considered phrasing content and is included in the result.

const { isPhrasing } = require('hast-util-phrasing');
const nodes = [
  { type: 'text', value: 'Hello, world!' },
  { type: 'element', tagName: 'div', children: [] }
];
const phrasingNodes = nodes.filter(isPhrasing);
console.log(phrasingNodes); // [{ type: 'text', value: 'Hello, world!' }]

Other packages similar to hast-util-phrasing

Keywords

FAQs

Package last updated on 27 May 2022

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