
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@flex-development/unist-util-types
Advanced tools
unist utility types
Ancestor<Tree, Child>Children<T>ColumnDecrement<[I]>InclusiveDescendant<Tree[, Max][, Depth]>Increment<[I]>IndexIsAncestor<Tree, Child[, Max][, Depth]>IsParent<Tree, Child>LineMatch<N, Check>MatchChildren<N[, Check]>MatchInclusiveDescendant<Tree, Check[, Max]>MatchProperties<N[, Check]>MatchValue<N[, Check]>OffsetParents<Tree[, Child]>PositionalInfo<[T]>TestTestFunction<[T][, P][, U]>
Type<[T]>UintValue<[T]>This package contains TypeScript definitions for working with unist and its ecosystem of utilities.
This package is ESM only.
In Node.js (version 18+) with yarn:
yarn add @flex-development/unist-util-types
See Git - Protocols | Yarn for details regarding installing from Git.
import type {
Ancestor,
Children,
Column,
InclusiveDescendant,
Index,
Line,
Match,
MatchChildren,
MatchInclusiveDescendant,
MatchProperties,
MatchValue,
Offset,
Parents,
PositionalInfo,
Test,
TestFunction,
Type,
Value
} from '@flex-development/unist-util-types'
Ancestor<Tree, Child>Collect nodes in Tree that can be ancestors of Child.
source:
src/ancestor.ts
Children<T>T (Node): tree to extract children fromsource:
src/children.ts
ColumnColumn in a source file (1-indexed integer).
source:
src/column.ts
Decrement<[I]>Subtract 1 from I while I is in the range [1, 10].
I (Uint): number to subtract from
10source:
src/decrement.ts
InclusiveDescendant<Tree[, Max][, Depth]>Collect all inclusive descendants of Tree.
Tree (Node): tree to collect descendants fromMax (Uint): maximum search depth
10Depth (Uint): current search depth
0source:
src/descendant-inclusive.ts
Increment<[I]>Add 1 to I while I is in the range [0, 9].
I (Uint): number to add to
0source:
src/increment.ts
IndexNumber of preceding siblings of a child node.
source:
src/index-number.ts
IsAncestor<Tree, Child[, Max][, Depth]>Check if Tree is an ancestor of Child.
Tree (Node): tree to checkChild (Node): expected child nodeMax (Uint): maximum search depth
10Depth (Uint): current search depth
0source:
src/is-ancestor.ts
IsParent<Tree, Child>Check if Tree is the parent of Child.
source:
src/is-parent.ts
LineLine in a source file (1-indexed integer).
source:
src/line.ts
Match<N, Check>Check if node N passes a test.
source:
src/match.ts
MatchChildren<N[, Check]>Extract children from node N if it passes a test.
source:
src/match-children.ts
MatchInclusiveDescendant<Tree, Check[, Max]>Check if inclusive descendants of Tree pass a test.
MatchProperties<N[, Check]>Extract properties of node N if it passes a test.
Properties of N are all fields except type.
source:
src/match-properties.ts
MatchValue<N[, Check]>Extract the value of node N if it passes a test.
source:
src/match-value.ts
OffsetIndex of a character in a source file (0-indexed integer).
source:
src/offset.ts
Parents<Tree[, Child]>Collect nodes in Tree that can be parents of Child.
All parents will be included in the resulting union if Child is any.
source:
src/parents.ts
PositionalInfo<[T]>Object containing the positional information of tree T.
source:
src/positional-info.ts
TestUnion of test types for a Node.
See unist-util-is for more details.
source:
src/test.ts
TestFunction<[T][, P][, U]>Check if a node passes a test.
T (Node): node to check
NodeP (Parent): parent(s) of node T
ParentU (any): this context
unknownfn(node[, index][, parent])Parameters:
node (T): node to checkindex (Index | undefined): index of node in parent.childrenparent (Parent | undefined): parent of nodeReturns:
boolean | undefined | void test result for node
source:
src/test-function.ts
Type<[T]>source:
src/type.ts
UintNumber used for iteration.
Range: [0, 10]
source:
src/uint.ts
Value<[T]>Extract the value of tree T.
source:
src/value.ts
See CONTRIBUTING.md.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
FAQs
unist utility types
We found that @flex-development/unist-util-types demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.