Socket
Book a DemoInstallSign in
Socket

unist-util-find-all-after

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

unist-util-find-all-after

unist utility to find nodes after another node

5.0.0
latest
Source
npmnpm
Version published
Maintainers
2
Created

What is unist-util-find-all-after?

The `unist-util-find-all-after` package is a utility for working with unist syntax trees. It allows you to find all nodes that come after a specified node in a tree, which can be useful for various tree manipulations and traversals.

What are unist-util-find-all-after's main functionalities?

Find all nodes after a given node

This feature allows you to find all nodes that come after a specified node in a unist tree. In this example, it finds all nodes that come after the first paragraph node.

const findAllAfter = require('unist-util-find-all-after');
const tree = {
  type: 'root',
  children: [
    { type: 'paragraph', value: 'First paragraph' },
    { type: 'paragraph', value: 'Second paragraph' },
    { type: 'paragraph', value: 'Third paragraph' }
  ]
};
const node = tree.children[0];
const result = findAllAfter(tree, node);
console.log(result);

Find all nodes of a specific type after a given node

This feature allows you to find all nodes of a specific type that come after a specified node in a unist tree. In this example, it finds all heading nodes that come after the first paragraph node.

const findAllAfter = require('unist-util-find-all-after');
const tree = {
  type: 'root',
  children: [
    { type: 'paragraph', value: 'First paragraph' },
    { type: 'heading', value: 'First heading' },
    { type: 'paragraph', value: 'Second paragraph' }
  ]
};
const node = tree.children[0];
const result = findAllAfter(tree, node, 'heading');
console.log(result);

Other packages similar to unist-util-find-all-after

Keywords

unist

FAQs

Package last updated on 07 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.