Socket
Socket
Sign inDemoInstall

unist-util-visit-parents

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unist-util-visit-parents - npm Package Compare versions

Comparing version 5.1.2 to 5.1.3

7

complex-types.d.ts
// To do: next major: remove this file?
export type {
// Used in `unist-util-visit`:
Matches,
InclusiveDescendant,
VisitorResult,

@@ -12,1 +10,6 @@

} from './index.js'
export type {
// Used in `unist-util-visit`:
Matches,
InclusiveDescendant
} from './lib/complex-types.js'

@@ -5,2 +5,2 @@ /**

*/
export function color(d: string): string
export function color(d: string): string;

@@ -5,2 +5,2 @@ /**

*/
export function color(d: string): string
export function color(d: string): string;
/**
* Continue traversing as normal.
*/
export const CONTINUE: true
export const CONTINUE: true;
/**
* Stop traversing immediately.
*/
export const EXIT: false
export const EXIT: false;
/**
* Do not traverse this node’s children.
*/
export const SKIP: 'skip'
export const SKIP: "skip";
/**

@@ -42,23 +42,10 @@ * Visit nodes, with ancestral information.

*/
export const visitParents: (<
Tree extends import('unist').Node<import('unist').Data>,
Check extends import('unist-util-is/lib/index.js').Test
>(
tree: Tree,
test: Check,
visitor: BuildVisitor<Tree, Check>,
reverse?: boolean | null | undefined
) => void) &
(<Tree_1 extends import('unist').Node<import('unist').Data>>(
tree: Tree_1,
visitor: BuildVisitor<Tree_1, string>,
reverse?: boolean | null | undefined
) => void)
export type Node = import('unist').Node
export type Parent = import('unist').Parent
export type Test = import('unist-util-is').Test
export const visitParents: (<Tree extends import("unist").Node<import("unist").Data>, Check extends import("unist-util-is/lib/index.js").Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) & (<Tree_1 extends import("unist").Node<import("unist").Data>>(tree: Tree_1, visitor: BuildVisitor<Tree_1, string>, reverse?: boolean | null | undefined) => void);
export type Node = import('unist').Node;
export type Parent = import('unist').Parent;
export type Test = import('unist-util-is').Test;
/**
* Union of the action types.
*/
export type Action = boolean | 'skip'
export type Action = boolean | 'skip';
/**

@@ -73,20 +60,11 @@ * Move to the sibling at `index` next (after node itself is completely

*/
export type Index = number
export type Index = number;
/**
* List with one or two values, the first an action, the second an index.
*/
export type ActionTuple = [
(Action | null | undefined | void)?,
(Index | null | undefined)?
]
export type ActionTuple = [(Action | null | undefined | void)?, (Index | null | undefined)?];
/**
* Any value that can be returned from a visitor.
*/
export type VisitorResult =
| Action
| [(void | Action | null | undefined)?, (number | null | undefined)?]
| Index
| null
| undefined
| void
export type VisitorResult = Action | [(void | Action | null | undefined)?, (number | null | undefined)?] | Index | null | undefined | void;
/**

@@ -110,14 +88,3 @@ * Handle a node (matching `test`, if given).

*/
export type Visitor<
Visited extends import('unist').Node<
import('unist').Data
> = import('unist').Node<import('unist').Data>,
Ancestor extends import('unist').Parent<
import('unist').Node<import('unist').Data>,
import('unist').Data
> = import('unist').Parent<
import('unist').Node<import('unist').Data>,
import('unist').Data
>
> = (node: Visited, ancestors: Array<Ancestor>) => VisitorResult
export type Visitor<Visited extends import("unist").Node<import("unist").Data> = import("unist").Node<import("unist").Data>, Ancestor extends import("unist").Parent<import("unist").Node<import("unist").Data>, import("unist").Data> = import("unist").Parent<import("unist").Node<import("unist").Data>, import("unist").Data>> = (node: Visited, ancestors: Array<Ancestor>) => VisitorResult;
/**

@@ -128,13 +95,2 @@ * Build a typed `Visitor` function from a tree and a test.

*/
export type BuildVisitor<
Tree extends import('unist').Node<
import('unist').Data
> = import('unist').Node<import('unist').Data>,
Check extends import('unist-util-is/lib/index.js').Test = string
> = Visitor<
import('./complex-types.js').Matches<
import('./complex-types.js').InclusiveDescendant<Tree>,
Check
>,
Extract<import('./complex-types.js').InclusiveDescendant<Tree>, Parent>
>
export type BuildVisitor<Tree extends import("unist").Node<import("unist").Data> = import("unist").Node<import("unist").Data>, Check extends import("unist-util-is/lib/index.js").Test = string> = Visitor<import('./complex-types.js').Matches<import('./complex-types.js').InclusiveDescendant<Tree>, Check>, Extract<import('./complex-types.js').InclusiveDescendant<Tree>, Parent>>;
{
"name": "unist-util-visit-parents",
"version": "5.1.2",
"version": "5.1.3",
"description": "unist utility to recursively walk over nodes, with ancestral information",

@@ -5,0 +5,0 @@ "license": "MIT",

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