unist-util-visit-parents
Advanced tools
Comparing version 5.1.2 to 5.1.3
// 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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
28156
422