MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / _walk

Method _walk

hyperagent-ext/media/scripts/highlight.min.js:34–36  ·  view source on GitHub ↗
(e,n)

Source from the content-addressed store, hash-verified

32 if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){
33 for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}
34 walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){
35 return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),
36 n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){
37 "string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{
38 l._collapse(e)})))}}class c extends l{constructor(e){super(),this.options=e}
39 addKeyword(e,n){""!==e&&(this.openNode(n),this.addText(e),this.closeNode())}

Callers 1

walkMethod · 0.80

Calls 3

addTextMethod · 0.45
openNodeMethod · 0.45
closeNodeMethod · 0.45

Tested by

no test coverage detected