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

Method _collapse

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

Source from the content-addressed store, hash-verified

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())}
40 addText(e){""!==e&&this.add(e)}addSublanguage(e,n){const t=e.root
41 ;t.sublanguage=!0,t.language=n,this.add(t)}toHTML(){

Callers

nothing calls this directly

Calls 1

everyMethod · 0.80

Tested by

no test coverage detected