Socket
Socket
Sign inDemoInstall

unist-util-visit

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unist-util-visit - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

complex-types.d.ts

34

index.d.ts

@@ -15,11 +15,3 @@ /**

test: Check,
visitor: Visitor<
import('unist-util-visit-parents/complex-types').Matches<
import('unist-util-visit-parents/complex-types').InclusiveDescendant<
Tree,
void
>,
Check
>
>,
visitor: import('./complex-types').BuildVisitor<Tree, Check>,
reverse?: boolean | undefined

@@ -29,8 +21,3 @@ ) => void) &

tree: Tree_1,
visitor: Visitor<
import('unist-util-visit-parents/complex-types').InclusiveDescendant<
Tree_1,
void
>
>,
visitor: import('./complex-types').BuildVisitor<Tree_1, string>,
reverse?: boolean | undefined

@@ -42,18 +29,3 @@ ) => void)

export type VisitorResult = import('unist-util-visit-parents').VisitorResult
/**
* Called when a node (matching test, if given) is found.
* Visitors are free to transform node.
* They can also transform the parent of node (the last of ancestors).
* Replacing node itself, if `SKIP` is not returned, still causes its descendants to be visited.
* If adding or removing previous siblings (or next siblings, in case of reverse) of node,
* visitor should return a new index (number) to specify the sibling to traverse after node is traversed.
* Adding or removing next siblings of node (or previous siblings, in case of reverse)
* is handled as expected without needing to return a new index.
* Removing the children property of an ancestor still results in them being traversed.
*/
export type Visitor<V extends import('unist').Node<import('unist').Data>> = (
node: V,
index: number | null,
parent: Parent | null
) => VisitorResult
export type Visitor = import('./complex-types').Visitor
import {CONTINUE} from 'unist-util-visit-parents'

@@ -60,0 +32,0 @@ import {SKIP} from 'unist-util-visit-parents'

@@ -6,23 +6,5 @@ /**

* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
* @typedef {import('./complex-types').Visitor} Visitor
*/
/**
* Called when a node (matching test, if given) is found.
* Visitors are free to transform node.
* They can also transform the parent of node (the last of ancestors).
* Replacing node itself, if `SKIP` is not returned, still causes its descendants to be visited.
* If adding or removing previous siblings (or next siblings, in case of reverse) of node,
* visitor should return a new index (number) to specify the sibling to traverse after node is traversed.
* Adding or removing next siblings of node (or previous siblings, in case of reverse)
* is handled as expected without needing to return a new index.
* Removing the children property of an ancestor still results in them being traversed.
*
* @template {Node} V
* @callback Visitor
* @param {V} node Found node
* @param {number|null} index Position of `node` in `parent`
* @param {Parent|null} parent Parent of `node`
* @returns {VisitorResult}
*/
import {visitParents, CONTINUE, SKIP, EXIT} from 'unist-util-visit-parents'

@@ -43,4 +25,4 @@

* @type {(
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: Visitor<import('unist-util-visit-parents/complex-types').Matches<import('unist-util-visit-parents/complex-types').InclusiveDescendant<Tree>, Check>>, reverse?: boolean) => void) &
* (<Tree extends Node>(tree: Tree, visitor: Visitor<import('unist-util-visit-parents/complex-types').InclusiveDescendant<Tree>>, reverse?: boolean) => void)
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types').BuildVisitor<Tree>, reverse?: boolean) => void)
* )}

@@ -52,3 +34,3 @@ */

* @param {Test} test
* @param {Visitor<Node>} visitor
* @param {import('./complex-types').Visitor} visitor
* @param {boolean} [reverse]

@@ -55,0 +37,0 @@ */

{
"name": "unist-util-visit",
"version": "4.0.0",
"version": "4.1.0",
"description": "unist utility to visit nodes",

@@ -46,2 +46,3 @@ "license": "MIT",

"files": [
"complex-types.d.ts",
"index.d.ts",

@@ -59,6 +60,6 @@ "index.js"

"prettier": "^2.0.0",
"remark": "^13.0.0",
"remark-cli": "^9.0.0",
"remark-gfm": "^1.0.0",
"remark-preset-wooorm": "^8.0.0",
"remark": "^14.0.0",
"remark-cli": "^10.0.0",
"remark-gfm": "^2.0.0",
"remark-preset-wooorm": "^9.0.0",
"rimraf": "^3.0.0",

@@ -69,7 +70,7 @@ "tape": "^5.0.0",

"typescript": "^4.0.0",
"xo": "^0.42.0"
"xo": "^0.44.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"build": "rimraf \"*.d.ts\" && tsc && tsd && type-coverage",
"build": "rimraf \"{index,test}.d.ts\" && tsc && tsd && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",

@@ -76,0 +77,0 @@ "test-api": "node test.js",

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