Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@unified-latex/unified-latex-util-split
Advanced tools
Functions to manipulate unified-latex
Abstract Syntax Tree (AST).
If you want break apart or join an array of nodes based on a condition. For example,
this is used to split on &
characters in the align
environment.
npm install @unified-latex/unified-latex-util-split
This package contains both esm and commonjs exports. To explicitly access the esm export,
import the .js
file. To explicitly access the commonjs export, import the .cjs
file.
arrayJoin(array, sep)
Joins an array of arrays with the item sep
function arrayJoin<T>(array: T[][], sep: T | T[]): T[];
Parameters
Param | Type |
---|---|
array | T[][] |
sep | T | T[] |
splitOnCondition(nodes, splitFunc, options)
Split a list of nodes based on whether splitFunc
returns true
.
If onlySplitOnFirstOccurrence
is set to true in the options
object, then
there will be at most two segments returned.
function splitOnCondition(
nodes: Ast.Node[],
splitFunc: (node: Ast.Node) => boolean,
options: { onlySplitOnFirstOccurrence?: boolean }
): { segments: Ast.Node[][]; separators: Ast.Node[] };
Parameters
Param | Type |
---|---|
nodes | Ast.Node[] |
splitFunc | (node: Ast.Node) => boolean |
options | Omitted |
splitOnMacro(ast, macroName)
Split an array of AST nodes based on a macro. An object {segments: [], macros: []}
is returned. The original array is reconstructed as
segments[0] + macros[0] + segments[1] + ...
.
function splitOnMacro(
ast: Ast.Node[],
macroName: string | string[]
): { segments: Ast.Node[][]; macros: Ast.Macro[] };
Parameters
Param | Type |
---|---|
ast | Ast.Node[] |
macroName | string | string[] |
unsplitOnMacro({ segments, macros, })
Does the reverse of splitOnMacro
function unsplitOnMacro({
segments,
macros,
}: {
segments: Ast.Node[][];
macros: Ast.Node[] | Ast.Node[][];
}): Ast.Node[];
Parameters
Param | Type |
---|---|
{ segments, macros, } | Omitted |
v1.4.0
unified
is compiled in rather than left as an external dependency. This is needed because unified
is ESM-only).minted
and listings
environments now accept optional arguments and parse their contents verbatim. This makes them much more efficient.FAQs
Functions for modifying a unified-latex AST
The npm package @unified-latex/unified-latex-util-split receives a total of 3,117 weekly downloads. As such, @unified-latex/unified-latex-util-split popularity was classified as popular.
We found that @unified-latex/unified-latex-util-split demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.