zimmerframe
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "zimmerframe", | ||
"description": "A tool for walking ASTs", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -126,3 +126,3 @@ # zimmerframe | ||
- `next(state?: State): void` — a function that allows you to control when child nodes are visited, and which state they are visited with | ||
- `next(state?: State): void` — a function that allows you to control when child nodes are visited, and which state they are visited with. If child visitors transform their inputs, this will return the transformed node (if not, returns `undefined`) | ||
- `path: Node[]` — an array of parent nodes. For example, to get the root node you would do `path.at(0)`; to get the current node's immediate parent you would do `path.at(-1)` | ||
@@ -129,0 +129,0 @@ - `state: State` — an object of the same type as the second argument to `walk`. Visitors can pass new state objects to their children with `next(childState)` or `visit(node, childState)` |
@@ -16,3 +16,3 @@ type BaseNode = { type: string }; | ||
export interface Context<T, U> { | ||
next: (state?: U) => void; | ||
next: (state?: U) => T | void; | ||
path: T[]; | ||
@@ -19,0 +19,0 @@ state: U; |
@@ -76,2 +76,6 @@ /** | ||
path.pop(); | ||
if (Object.keys(mutations).length > 0) { | ||
return { ...node, ...mutations }; | ||
} | ||
}, | ||
@@ -107,2 +111,4 @@ stop: () => { | ||
}); | ||
return inner_result; | ||
} | ||
@@ -109,0 +115,0 @@ }); |
@@ -20,3 +20,3 @@ declare module 'zimmerframe' { | ||
export interface Context<T, U> { | ||
next: (state?: U) => void; | ||
next: (state?: U) => T | void; | ||
path: T[]; | ||
@@ -23,0 +23,0 @@ state: U; |
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
11703
154