@bablr/agast-helpers 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tree.js +10 -0
- package/package.json +2 -2
package/lib/tree.js
CHANGED
|
@@ -552,6 +552,16 @@ export const getRoot = (node) => {
|
|
|
552
552
|
return node.type == null ? node.properties['.'] : node;
|
|
553
553
|
};
|
|
554
554
|
|
|
555
|
+
export function* traverseProperties(properties) {
|
|
556
|
+
for (const value of Object.values(properties)) {
|
|
557
|
+
if (isArray(value)) {
|
|
558
|
+
yield* btree.traverse(value);
|
|
559
|
+
} else {
|
|
560
|
+
yield value;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
555
565
|
export class Resolver {
|
|
556
566
|
constructor(
|
|
557
567
|
states = emptyStack.push({ properties: new Map(), idx: 0 }),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bablr/agast-helpers",
|
|
3
3
|
"description": "Helper functions for working with agAST trees",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"author": "Conrad Buck<conartist6@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@bablr/btree": "0.1.0",
|
|
23
|
+
"@bablr/btree": "^0.1.0",
|
|
24
24
|
"@bablr/coroutine": "0.1.0",
|
|
25
25
|
"@iter-tools/imm-stack": "1.1.0"
|
|
26
26
|
},
|